0
Answered

Raycasting

itsthehawke 2 weeks ago in Game Creator updated by Marti (Lead Developer) 1 week ago 5

Hello.

Is there a plan to integrate raycasting into Game Creator?

Unity version:
2018.4.9f1
Game Creator version:
1.0.4

Answer

Answer
Answered

Game Creator already has numerous features where raycasts are used. However, in order to make it user-friendly we prefer to use more higher-level names.


For example, there's a Condition in the Behavior module called "Can X See Y". This allows to check if a character can see another object. We internally use a Raycast (plus some tricks to make this more performant). You don't have to worry about setting an origin point, getting the target point, calculating the direction and so on. We handle the math so you can use a more natural language like "Does the Player see Cube (3)?

Answer
Answered

Game Creator already has numerous features where raycasts are used. However, in order to make it user-friendly we prefer to use more higher-level names.


For example, there's a Condition in the Behavior module called "Can X See Y". This allows to check if a character can see another object. We internally use a Raycast (plus some tricks to make this more performant). You don't have to worry about setting an origin point, getting the target point, calculating the direction and so on. We handle the math so you can use a more natural language like "Does the Player see Cube (3)?

I understand.

Thought of it maybe as a function that would let you set the origin point, length and then apply a set of conditions and actions.


Raycasting is a powerful tool although my knowledge of it and Csharp in General is limited.

+1

Yeah definitely it is. You might be looking for this Condition at the Game Creator Hub. It's called Can See and basically checks if there's any collision between two game objects in the scene by raycasting a line: https://hub.gamecreator.io/content/item/nSqv3SXi5Bot5384SQh7

Thank you very much