Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 14,540 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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