|
Re: ground normal
[Re: ello]
#301307
12/09/09 16:08
12/09/09 16:08
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
no problem: var angle[3]; c_trace(my.x, vector(0,0,my.z-1000), USE_BOX); vec_to_angle(vector(angle[0],angle[1],angle[2]), normal); set(my.x, vector(target.x, target.y, target.z+my.min_z*cos(angle[2]))); my.pan = angle[0]; my.tilt= angle[1];
should work but not tested - sorry for that.
|
|
|
Re: ground normal
[Re: ello]
#301368
12/09/09 23:10
12/09/09 23:10
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
An old post of mine: If the hovering vehicle is close to the ground it adapts its orientation to the slope, otherwise it normalizes its rotation.
if(c_trace(my.x,vector(my.x,my.y,my.z-150),IGNORE_ME | IGNORE_PASSABLE)) { vec_rotate(normal,vector(-my.pan,0,0)); my.tilt = -asin(normal.x); my.roll = -asin(normal.y); } else { my.tilt += -my.tilt/5*time; my.roll += -my.roll/5*time; }
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: ground normal
[Re: ello]
#339189
08/25/10 08:37
08/25/10 08:37
|
Joined: Jan 2007
Posts: 2,247 Deutsch Niedersachsen
Puppeteer
Expert
|
Expert
Joined: Jan 2007
Posts: 2,247
Deutsch Niedersachsen
|
@ Superku: I am using a similar solution but both lack the ability to adjust the angles right when normal.z<0. It should be easy to do but i dont get it.
Okay it really is easy. Just add 180 to pan and roll.
Last edited by Puppeteer; 08/26/10 12:24.
|
|
|
|