How to define a position based on an angle ?

Hi,

I have an object(the player) and I have an angle. The angle defines the direction of the movement of the object, well this is the goal.

Is it possible to fill a var with a position based on that angle? What I had in mind was to check the position in a distance of x to the object with the given angle, then fill a var with it and use this var to do the whole movement part. I would use the position to give the object the movement direction and add an multiplier to it, so I can tweak the speed of it.

Is this possible, if yes, how can I get the needed position?

Would be great if someone could help.

Marcus

I imagine a raycast is probably the way to go, cast from you char using your required angle in the raycast and you can set the distance and mover speed on the walker/mover script you’re putting together.

A raycast? Hm, didn’t thought of that, but might work, if if define an area around the object that can take the hit.

I had a look into raycasts and it doesn’t seem to work. The direction of the ray seems to be a position in the world, not an angle.

The only other method I can think of would be to have an EGO as a child of the player object and use an offset value to create your angle (Or to be affected by your angle inversely) and have the player object move towards it.
Not sure if this is more in the line of thinking, it’s a little difficult to dissern from your original post.

What’s an EGO?

Empty Game Object

Solved :slight_smile:

I used two empty objects. The first one uses the same transform as the position and the defined angle. The second object is a children ob the first on with an offset of 1, so when I rotate the first object based on the angle, I get the target position out of the second object.

Thanks for the help.