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
1 registered members (TipmyPip), 18,388 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
Page 2 of 2 1 2
Re: Spherical gravity [Re: alibaba] #367805
04/18/11 16:51
04/18/11 16:51
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Quote:
One more Question Julz, sorry that i am asking that much.
No worries laugh I'm not normally very helpful around here but these kind of problems really interest me (hence my original quaternion and alignToVec contributions). If I didn't want to help out I'd leave it for someone else to answer.

It's hard to define an absolute pan orientation when an object's local z axis is changing. I think the best approach is to find a vector that represents the direction you want the object to face, and then rotate around one axis to face that vector.

Here's a slightly changed action le():
Code:
action le()
{
	var relTilt = 0;
	player=me;
	VECTOR temp;
	while(1)
	{		
		gravitz();
		if(key_space&&!oben)
		walk_speed.z=5;
		my.skill9=100*(key_k-key_l);  //Target angle/ 100 or -100
		alignToVec(my.pan, normal, vector(0, 0, 1), time_step);

		vec_for_angle(temp, vector(my.skill9, 0, 0)); // get a vector pointing where we want to point
		vec_rotateback(temp, my.pan); // find that vector relative to the entity's current orientation
		vec_to_angle(temp, temp); // convert to a rotation
		c_rotate(my, vector(ang(temp.x*0.9*time_step),0,0),GLIDE|USE_AXISR);
		
		c_move(my,vector((key_w-key_s)*20*time_step,(key_a-key_d)*20*time_step,walk_speed.z),nullvector,GLIDE | IGNORE_PASSABLE|IGNORE_FLAG2);

		wait(1);
	}
	
}


I don't think it's a good idea that you use c_rotate and change the entity's orientation directly (passing my.pan to alignToVec). The latter doesn't perform any collision detection, and the former is unnecessarily slow if your objects have complete spherical symmetry (max_x = max_y = max_z = -min_x = -min_y = -min_z). I did it your way anyway because I wanted to change your code as little as necessary.

I hope that makes sense.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Spherical gravity [Re: JibbSmart] #367808
04/18/11 17:23
04/18/11 17:23
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
You are awesome! laugh
The object isn´t jerking around now, but if i´m a bit higher then the object rotates in opposite.
so if i press k the the object turns right. I hope you understand what i mean.
If you want you can try it yourself.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Spherical gravity [Re: alibaba] #367815
04/18/11 18:59
04/18/11 18:59
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Yes, the object is trying to face the given pan as if it is rotated around the world's z axis.

I'm not sure how to get the behaviour you want. Perhaps someone else can try, or I might put more time into it later, but I've got other things I need to get done today.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Spherical gravity [Re: JibbSmart] #367816
04/18/11 19:00
04/18/11 19:00
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline OP
Expert
alibaba  Offline OP
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Okay, Thank you anyway! laugh
You are great!


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Page 2 of 2 1 2

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