Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Tilting objects with matrix?

Author
Message
gbark
19
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 4th Dec 2005 22:43
Hello,

I'm working on a racing game, I've got the car's movement and controls down (at least the prototype version), but I cannot figure out how to rotate the car to fit the matrix landscape I'm using!

I tried several forum searches, didn't find anything there, and looked at the Binary Moon Limit Rush tutorial, but it said:

Quote: "Now that the vehicle is loaded it has become very obvious that it isn't tilting to the landscape as it would in real life.

How do we know what angle the vehicle is at then?

Well we don't. There are a number of math's ways that could work it out for us but I don't want to do any confusing math's tilting the object so that it looks right is more than enough."


A) I would rather learn the correct mathematical way of doing this, as I want it to be as accurate as possible... (I'm guessing I would use ATANFULL()??) and -

B) The method in the tutorial still doesn't look right, especially when the vehicle turns.

So, what I'm asking:

Can someone show me to tell me the correct way to use the FRONT, BACK, LEFT, and RIGHT ground heights of the car, and use those variables with, I'm guessing, ATANFULL() to rotate the car correctly from ANY 'Y' angle?

My current code: (The bit that gets the X & Z positions, and ground heights, of each side of the car)


Now what?

Thanks, any and all help greatly appreciated!


-gbark
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 4th Dec 2005 22:49
What you would want to do is find the height of the points of the matrix tile, then find the angle they create and tilt your ship/car/person to that angle.


Join Our Forums and get game updates faster!
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 4th Dec 2005 22:56
Keep reading the Limit Rush tutorial. It does actually tell you how to do it.
gbark
19
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 4th Dec 2005 23:16
Quote: "What you would want to do is find the height of the points of the matrix tile, then find the angle they create and tilt your ship/car/person to that angle."


Yep, that's just the part I'm having trouble with.

Quote: "Keep reading the Limit Rush tutorial. It does actually tell you how to do it."


I have read thru the whole tutorial, but all I could find on the subject was the following code:



It works so-so, it's just not very accurate.
gbark
19
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 5th Dec 2005 22:58
Mmkay, I've done a bit more searching, finally found some stuff, but I'm still a little off...



The 'X' rotation works like a charm. I can now drive the car fowards, backwards, and all around the hills and dips in my matrix, and it tilts fowards and back perfectly. But, the 'Z' rotation is still pretty screwy, haven't been able to solve that one yet. Any ideas anyone?

Hope to finally solve this, I've been stuck at getting the car to tilt with the matrix for a few days now...

Any help appreciated.

Login to post a reply

Server time is: 2024-11-27 12:58:53
Your offset time is: 2024-11-27 12:58:53