Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
bone to angle #266539
05/18/09 16:18
05/18/09 16:18
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline OP
Serious User
darkinferno  Offline OP
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
ok, i'm trying to get a bone to look towards a certain position, the following works perfectly until the model's pan is non-zero

Code:
VECTOR temps,bonrot,temps2,bonrot2;


function aimtest()
{
	while(1)
	{
		vec_set(temps2, camera.x);
		vec_sub(temps2, bonrot2.x);
		vec_sub(temps2,vector(0,0,60));
		vec_inverse(temps2);
		vec_to_angle(my.pan, temps2);
		
		my.z=you.z-250*sin(my.tilt);
		my.x=you.x+250*sin(my.pan-90)*sin(my.tilt+90);
		my.y=you.y-250*cos(my.pan-90)*sin(my.tilt+90);
		wait(1);
	}
}

function bonetester()
{
	ENTITY* thispointer;
	thispointer=ent_create("test2.mdl",vector(my.x+100,my.y,my.z),aimtest);
	while(1)
	{

			vec_set(temps, thispointer.x);
			vec_sub(temps, bonrot.x);
			vec_sub(temps,vector(0,0,60));
			vec_to_angle(bonrot, temps);
			
			
			bonrot.x=clamp(bonrot.x,-60,60);
			bonrot.y=clamp(bonrot.y,-50,80);			

			
			ent_bonereset_all(my);
			ent_bonerotate(my,"spine",vector(bonrot.x,bonrot.y,0));


		wait(1);
	}
}


any ideas?

Re: bone to angle [Re: darkinferno] #266540
05/18/09 16:21
05/18/09 16:21
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
You have to rotate the bone not absolute, but relative.
Use ang() for that;

ent_bonerotate(my,"spine",vector(ang(my.pan-bonrot.x),ang(my.tilt-bonrot.y,0));

Re: bone to angle [Re: the_clown] #266544
05/18/09 16:30
05/18/09 16:30
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline OP
Serious User
darkinferno  Offline OP
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
i am aware but when the model rotates, the bone isnt updating to look at the target position...

Re: bone to angle [Re: darkinferno] #266549
05/18/09 16:37
05/18/09 16:37
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Hum. That's bad.
I'm using the same method as you do, with ang(), and it works...

Re: bone to angle [Re: the_clown] #266557
05/18/09 17:00
05/18/09 17:00
Joined: May 2009
Posts: 1,816
at my pc (duh)
darkinferno Offline OP
Serious User
darkinferno  Offline OP
Serious User

Joined: May 2009
Posts: 1,816
at my pc (duh)
strange, you willing to share the code because i cant see where i'm going wrong wink

Last edited by darkinferno; 05/18/09 17:13.
Re: bone to angle [Re: darkinferno] #266695
05/19/09 08:59
05/19/09 08:59
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Shure, as soon as I get home.


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