Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 466 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
how do i make my model turn toward the enemy model? #312435
02/24/10 19:31
02/24/10 19:31
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
Hi!

how do i make my model turn toward the enemy model?
I tried to use this code:

----------------------------------
vec_set(enemypos, enemy.x);
vec_sub(enemypos, my.x);
vec_to_angle(my.pan, enemypos);
my.tilt = 0;
------------------------------------

but when i try to run the level after writing that code, I get an error saying that the action crashed?

how do i do?

thanks!!!

- Muhsin Kaymak


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how do i make my model turn toward the enemy model? [Re: Muhsin] #312437
02/24/10 19:43
02/24/10 19:43
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
make sure the enemypos,enemy and my is valid for that action


3333333333
Re: how do i make my model turn toward the enemy model? [Re: Quad] #312439
02/24/10 19:51
02/24/10 19:51
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
you have to write "enemypos.x" .


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: how do i make my model turn toward the enemy model? [Re: alibaba] #312464
02/24/10 22:49
02/24/10 22:49
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
enemypos could be a vector, in such case it doesnot really make a diffrence.


3333333333
Re: how do i make my model turn toward the enemy model? [Re: Quad] #312534
02/25/10 13:33
02/25/10 13:33
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
here is my code for the enemy:

-----------------------------
action enemy_dummy()
{

enemy = my;

while(1)
{


wait(1);
}
}
-------------------------------

and here is the code for the model:

--------------------------------
action player_machinegun_rotater()
{
my.group = 2;

VECTOR enemypos;

while(1)
{

vec_set(enemypos, enemy.x);
vec_sub(enemypos, my.x);
vec_to_angle(my.pan, enemypos);
my.tilt = 0;

set(my,PASSABLE);

wait(1);
}
}
------------------------------------------------

what am i doing wrong?


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how do i make my model turn toward the enemy model? [Re: Muhsin] #312541
02/25/10 14:44
02/25/10 14:44
Joined: Oct 2005
Posts: 196
ambe Offline
Member
ambe  Offline
Member

Joined: Oct 2005
Posts: 196
Try something like this-

Code:
VECTOR* My_Vector = {x=0;y=0;z=0;}

...

My_Vector.x = enemy.x - 3 * cos(my.x); // Play around with "3"
My_Vector.y = enemy.y - 3 * sin(my.x);
My_Vector.z = enemy.z;
		
vec_set (My_Vector.x, player.x);
vec_sub (My_Vector.x, my.x);
vec_to_angle (my.pan, My_Vector.x); // rotate it towards the target

...



Last edited by ambe; 02/25/10 14:46.

- code monkey
Re: how do i make my model turn toward the enemy model? [Re: ambe] #312547
02/25/10 15:00
02/25/10 15:00
Joined: Nov 2008
Posts: 196
the wrong place
Muhsin Offline OP
Member
Muhsin  Offline OP
Member

Joined: Nov 2008
Posts: 196
the wrong place
it still doesn't work... could it be something in my script, i didn't write correct??


Come and play my new browsergame - Valley Of Wolves:

http://www.mafiacreator.com/ValleyOfWolves

Hurry and be the first to take over the different business' in the Valley Of Wolves, before anybody else does it!
And be the most feared MafiaBoss in the World!!
Re: how do i make my model turn toward the enemy model? [Re: Muhsin] #312576
02/25/10 15:59
02/25/10 15:59
Joined: Feb 2010
Posts: 457
Norfolk,England
mikaldinho Offline
Senior Member
mikaldinho  Offline
Senior Member

Joined: Feb 2010
Posts: 457
Norfolk,England
have you tried to make them face each other in the 1st place?

Re: how do i make my model turn toward the enemy model? [Re: mikaldinho] #312587
02/25/10 16:17
02/25/10 16:17
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
@mika, stop the stupid comments, you have no idea what you are talking about.

@muhsin, send me the project i will look in to this.


3333333333
Re: how do i make my model turn toward the enemy model? [Re: Quad] #312589
02/25/10 16:23
02/25/10 16:23
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Well, pretty easy laugh

He setted the enemy to the action "my"

That means the angle from me to me is not defined wink

Page 1 of 2 1 2

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