Move player forward In their direction
-
Im trying to make a raycasting system, and i need to move a projectile out of a wall from where it came frim
@IAmPotat The Raycast Test behavior outputs a
normalfield. This is the angle that the ray would travel if it were to reflect. You can use this to rotate an object to that angle, and then use a Calculate Direction behavior to calculate thex_vectorandy_vectorfrom the center of the object to where it's facing. You can use those values to determine how much your object moves when a ray has intersected with an object.If you need help on how to use the behavior, this video has step-by-step examples:
-
I IAmPotat marked this topic as a question on
-
You can use a Move to Object behavior and move the object to itself. But change the anchor point of the second object to be slightly above the origin. Now the object will move "forward" regardless of the rotation. So at 0 degrees, it will move up, and when rotated 90 degrees clockwise, it will move right.
-
Hey,
So you could use an attribute system to set when the player is in a certain direction. For example, create an attribute in an object’s menu settings called “Direction“. When the player is facing to the right (or doing anything that makes them face right) set the Direction to “Right”. If left for any reason, set it to “Left”.
When you go to move the player, Get Attribute, and If attribute = Right, move the player in the positive X axis, and If attribute = Left, move player along the negative X axis.
This is one of many ways.
Behaviors Used
- Set Attribute
- Get Attribute
- If
- Move by
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login