Sign in to follow this  
Fist

getPointFromDistanceRotation with z ?

Recommended Posts

I can't figure out on how i can add z calculations for getPointFromDistanceRotation function from useful functions in wiki.

Function is like this

function getPointFromDistanceRotation(x, y, dist, angle)
	local a = math.rad(90-angle)
	local dx = math.cos(a)*dist
	local dy = math.sin(a)*dist
	return x+dx, y+dy;
end

but i need to add a z value as well, so it calculates how far z should go from original position to distance and angle. Anyone can help?

Share this post


Link to post

I'm just lazy to explain that :~, but trust me, it's just some geometry and trigonometry, simple :~.

Share this post


Link to post

yeah i already managed to do it. I just used wrong angle that's why i couldn't get it but thanks anyway!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.