Jump to content
Sign in to follow this  
nullsystems

Cos,Sin,Tan - Math Problem With Directions

Recommended Posts

Hello,

Im having some trouble trying to work out some sin,cos,tan work.

Im basically trying to get an object to be 1 meter infront of the player and have the object facing the player. My problem is of course, when you turn to face a different direction ( 10, 65, 123 degrees, etc ) the object does not turn and face the player.

I know this is going to be a simple math function but I cannot for the life of me find it.

Any help would be appreciate.

I have included an image below, so you can see.

The campfire is always facing the player, but also 1 meter away, no matter what direction the player faces.

example.jpg

PS: Im fine with creating the object and setpos'ing it, just getting the correct trig direction.

Share this post


Link to post
Share on other sites

which are you having the issue with? putting the object 1 meter infront or facing the player?

fire setpos [(getpos player 0) + ((1)*sin(getdir player )), (getpos player select 1) + ((1)*cos(getdir player))];
fire setdir (getdir player) - 180
fire setpos (getpos fire)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×