Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,191 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
squik, AemStones, LucasJoshua, Baklazhan, Hanky27
19060 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 | 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