Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 08/17/26 19:28
Max Number of Strategies in /Strategy folder
by Martin_HH. 08/17/26 07:54
Pause button for evaluation shell?
by AndrewAMD. 08/13/26 17:16
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 08/10/26 12:46
phantom() not defined in indicators.c
by jcl. 08/07/26 11:45
Accepting new programming clients
by AndrewAMD. 08/06/26 21:25
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (Lapsa, swingtraderkk), 7,758 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
riggi89, shuhari, KD1990, Student_64151, Koti
19230 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Calculate the difference between .pan 1 and .pan 2 #232905
10/24/08 21:39
10/24/08 21:39
Joined: Nov 2005
Posts: 66
Spokane, WA, USA
Vonman Offline OP
Junior Member
Vonman  Offline OP
Junior Member

Joined: Nov 2005
Posts: 66
Spokane, WA, USA
Hi, i'm trying to create script physics for a vehicle. I'm not trying ask how to do that, but I have this little problem and i'm curious of what you guys might do in my case.

I'm trying to write a small set of instructions that causes the velocity of the tire to be reduced by a "friction_force" (nevermind the friction_dir).. Basicaly, like a real car, assuming you are not actualy turning, if the front tires are turned (say) 45 degrees to the right, then you would have a force against the velocity of the wheel at a magnitude equall to 50% of the maximum grip of that tire.

If you look at the PATTERN, you might get an idea what i'm talking about.. The degrees relitive means the difference in the .pan angle between the tire.pan and the true direction of velocity.

*Degrees
Relitive *Percent of force
against the velocity

At 0 -- 0 force |
At 22.5 -- 25% force
At 45 -- 50% force /
At 67.5 -- 75% force
at 90 -- 100% force --
at 112.5 -- 75% force
at 135 -- 50% force \
at 157.5 -- 25% force
at 180 -- 0% force |


Now if I can find a way to calculate the difference between the wheel.pan and the velocity_dir.pan, then thats all I need.
BUT!

It's not as easy as:

anglediff = velocity_dir.pan - wheel.pan;

or

vec_diff(anglediff,velocity_dir.pan,wheel.pan;

Those won't work BECAUSE of this...

If my velocity_dir.pan was facing exactly "20" in world coords and my wheel.pan is facing "350" in world coords, and then I subtracted them, this is what it would look like...

The REAL difference in degrees is "30".

But the result you get when subtracting this in world coords with a "360 degree" system is.
20 - 350 = -330 //!!

I've also tryed using ang(wheel.pan) and ang(velocity_dir.pan) and it worked until it reached 180 degrees and then spiked for a second (that means every time the car is facing 180 in world coords, there will be a spike effect in the physics).

Re: Calculate the difference between .pan 1 and .pan 2 [Re: Vonman] #232935
10/25/08 07:52
10/25/08 07:52
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Hint:
Shift your angles to values between -180 and +180 first using the ang() command.
Manual site:
http://www.conitec.net/beta/avar-ang.htm


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1