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,618 guests, and 5 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
3D orientation problem #129473
05/11/07 18:15
05/11/07 18:15
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
I have a little problem with "turn to me and look at me" in 3D

Code:
 
function turn_me(angle)
{
angle = ang(angle - MY.PAN);
if (angle > 10) {temp = my.speed;}
else{
if(angle < -10){temp = -my.speed;}
else{temp = my.speed * angle * 0.1;}
}
c_rotate(me,vector(temp * time_step, temp * time_step, 0),ignore_passable | use_axisr | USE_AABB);

}

in NPC loop I've wrote this:
vec_diff(temp,you.pos,my.pos);
result = vec_to_angle(my_angle,temp);
turn_me(my_angle.PAN);



Problem is that NPC only change his pan not tilt to look at me.
I want to make something like this:
Code:
 
vec_set(temp,you.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan, temp);


but with delay to make turning more smooth in 3D (pan and tilt).


Never say never.
Re: 3D orientation problem [Re: tompo] #129474
05/11/07 20:12
05/11/07 20:12
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Code:

var speed = 0.02;

action myEntity
{
while (my != NULL)
{
if (key_space) // start pan and tilt
{
while(my.pan != youEntity.pan || my.tilt != youEntity.tilt)
{
vec_diff(temp,youEntity.x,my.x);
vec_to_angle(my.skill1,temp);
my.skill4 = ang(my.skill1 - my.pan);
my.skill5 = ang(my.skill2 - my.tilt);

my.pan += speed * my.skill4 * time_step;
my.tilt += speed * my.skill5 * time_step;
wait(1);
}
}
}

wait(1);
}



EDIT
----
Modified the while condition. Maybe split it into
two while-loop.


Last edited by vlau; 05/11/07 20:27.
Re: 3D orientation problem [Re: vlau] #129475
05/11/07 21:26
05/11/07 21:26
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
I've made it this way... and working
Code:
 
vec_to_angle(temp_pan,vec_diff(temp,you.x,my.x));
my.pan += ang(temp_pan.pan -my.pan)*0.2*time_step;
my.tilt += ang(temp_pan.tilt -my.tilt)*0.2*time_step;



Last edited by tompo; 05/11/07 21:26.

Never say never.
Re: 3D orientation problem [Re: tompo] #129476
05/12/07 08:08
05/12/07 08:08
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Ok, better add this line also:

my.roll += ang(temp_pan.roll-my.roll)*0.2*time_step;


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