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
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 13,972 guests, and 6 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
Trying to create "wall-running". #247792
01/22/09 16:38
01/22/09 16:38
Joined: Jan 2009
Posts: 20
T
Tuah Offline OP
Newbie
Tuah  Offline OP
Newbie
T

Joined: Jan 2009
Posts: 20
I've been working on a "wall running" script, but I'm quite a novice so I don't know if I'm on the right track. Basically what I want this to do is that if a character is standing on a surface that is not level, to turn its body so that it is standing 'upright', directly from the normal.

I came up with this script from a "place_me_on_floor" script, changed so it would be applicable to any surface.

Code:
function place_me_on_surface
{	
	vec_set(temp,my.z); //set primary vector
 	temp.z -= 5; // 'bout half a foot from the surface
	var_angle[3] + { my.pan, my.tilt, my.roll }; // point angle in the direction of character's feet
	vec_rotate(temp,angle); //rotate vector
 	c_trace(my.z, temp, IGNORE_ME); //trace from character's feet about half a foot
 	vec_set(my.z, target); // put on surface
 	vec_to_angle(my.tilt, normal); // stand "upright" from normal
 	vec_to_angle(my.roll, normal);
}	 


Last edited by Tuah; 01/22/09 16:39.
Re: Trying to create "wall-running". [Re: Tuah] #247881
01/23/09 04:02
01/23/09 04:02
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
This will probably crash:

vec_set(temp,my.z);

"my.z" is not a vector, so you will copy garbage. "my.x" is a vector that included x,y,z.

vec_to_angle(my.roll, normal);

This also crashes, for same reason. "my.pan" is a vector that includes pan, tilt, roll, but my.roll is not a vector.

You want probably to do something like this:

c_trace(my.x,vector(my.x,my.y,my.z-5), IGNORE_ME);
vec_to_angle(my.pan,normal);

Re: Trying to create "wall-running". [Re: Tobias] #247884
01/23/09 04:36
01/23/09 04:36
Joined: Jan 2009
Posts: 20
T
Tuah Offline OP
Newbie
Tuah  Offline OP
Newbie
T

Joined: Jan 2009
Posts: 20
Ah, I get it. my.x and my.pan refer to the whole of an object's position? I figured I'd have to be more specific with it. I'll go try to work it in now.


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