How can I get the opposite of a direction?
How can I get the opposite of a direction?
Like adding 180 degrees to and angle. I don't think there is any more explanation needed for this.
Re: How can I get the opposite of a direction?
Pi is 180 degrees for any angle calculations:
Code: Select all
opposite = direction + math.pi
Re: How can I get the opposite of a direction?
How is the direction given? If it's a vector, then just change the signs of the components.
Re: How can I get the opposite of a direction?
Thanks so much. That worked.darkfrei wrote: ↑Sun Sep 11, 2022 12:13 pmPi is 180 degrees for any angle calculations:Also 90 degrees is half pi and 360 degrees is a 2*pi. But people must to know about the Tau.Code: Select all
opposite = direction + math.pi
Re: How can I get the opposite of a direction?
Off topic, but thanks for sharing that link! I'm a bit of a math nerd and I hadn't heard about that.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Re: How can I get the opposite of a direction?
All hail Tau - the more sensible constant!
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Who is online
Users browsing this forum: No registered users and 6 guests