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
1 registered members (alibaba), 3,525 guests, and 18 spiders.
Key: Admin, Global Mod, Mod
Newest Members
juergenwue, VladMak, Geir, ondrej, mredit
19208 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