Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ground normal #301298
12/09/09 15:19
12/09/09 15:19
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
Hi there,

i am trying to align objects to the surface angle by using c_trace and normal (or hit.nx) . but i cant get it to work. the forum search is a bint unhandy with this, so maybe someone can point out what needs to be done to align a model properly

thanks in advance,
ello

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 Offline
Expert
Rei_Ayanami  Offline
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: Rei_Ayanami] #301315
12/09/09 16:20
12/09/09 16:20
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
thank you for the input.. something is happening but not exactly what i thought. the entity is rotated but when moving it, the rotation is not updating correctly..

any ideas?

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 Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
An old post of mine:

Quote:

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: Superku] #301392
12/10/09 07:18
12/10/09 07:18
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline OP
Senior Expert
ello  Offline OP
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
thank you... this works perfect!

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 Offline
Expert
Puppeteer  Offline
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.

Formally known as Omega
Avatar randomness by Quadraxas & Blade
http://omegapuppeteer.mybrute.com

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

Gamestudio download | chip programmers | 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