Gamestudio Links
Zorro Links
Newest Posts
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (Grant, vince, 1 invisible), 4,352 guests, and 25 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Geir, ondrej, mredit, vestriaa, Lukudo
19206 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
vec_to_angle and tilt #146938
08/09/07 17:18
08/09/07 17:18
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Heya,

this question... well

Its simple:

I want an entity to turn towards a target

Code:

vec_set(temp,vecTarget.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);



In order to maintain the entity vertical i will use my.tilt = 0.

But i want to control the entity´s TILT like rotating and pointing always to the target, vg. my.tilt += 10 * time_step;

But this dont work, so i ask which will be the way to do that?

Thanks.
Cheers

Re: vec_to_angle and tilt [Re: demiGod] #146939
08/09/07 17:39
08/09/07 17:39
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
Can you explain a little more on specifically what you want?
Do you mean like a gun turret tracking an aircraft?
Perhaps you need to set roll to 0, and let pan and tilt be
set by vec_to_angle.


Not two, not one.
Re: vec_to_angle and tilt [Re: Grafton] #146940
08/09/07 17:46
08/09/07 17:46
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Well,

imagine an entity always facing a target, but that entity needs to be always rotating around its y axis or changing its tilt angle..

Re: vec_to_angle and tilt [Re: demiGod] #146941
08/09/07 18:00
08/09/07 18:00
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
Do you mean you want to control the tilt manually while the pan always looks at a target?
If so, here is a quick example using the mouse to manually control the tilt:
Code:
  

var tilt_ang;

while(me)
{
vec_set(temp,vecTarget.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan,temp);

my.tilt = 0;
tilt_ang += (mouse_force.y * 3) * time_step;
tilt_ang = clamp(tilt_ang, -80, 80); //clamp tilt between 80 and -80 degrees
my.tilt += tilt_ang;

wait(1);
}




You might also want to set the roll to 0 when you set the tilt to 0, or your "my" will roll.



Not two, not one.
Re: vec_to_angle and tilt [Re: Grafton] #146942
08/09/07 18:12
08/09/07 18:12
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Yeap, that´s it very simple, but my head its almost blowing up today..

Thanks Josiah,

Cheers

Re: vec_to_angle and tilt [Re: demiGod] #146943
08/09/07 18:15
08/09/07 18:15
Joined: Jun 2005
Posts: 656
G
Grafton Offline
User
Grafton  Offline
User
G

Joined: Jun 2005
Posts: 656
hehe, I know what you mean, happens to me quite often.

Good luck!


Not two, not one.

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