Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to combine x,y,z,pan,tilt,roll in one element ? #341370
09/15/10 15:19
09/15/10 15:19
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
How can i turn my canon to the you position? I have a simplified version of my code below, please asume the you pointer is set..

What i basicly want to know is how to combine a vector and angle in one element like 'before' with wdl

Code:
function act_canon()
{
    var temp;
    VECTOR testvec;
    
    while(1)
    {
        vec_set(temp,you.x);
        vec_sub(temp,testvec.x);
        vec_to_angle(testvec.pan,temp);
        
        ent_bonerotate(my,"canon",testvec.pan);
        wait(1);
    }
}



Re: How to combine x,y,z,pan,tilt,roll in one element ? [Re: Toon] #341371
09/15/10 16:04
09/15/10 16:04
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
Code:
function act_canon()
{
    VECTOR temp;
    VECTOR testvec;
    
    while(1)
    {
        vec_set(temp.x, you.x);
        vec_sub(temp.x, testvec.x);
        vec_to_angle(testvec.x, temp.x);
        
        ent_bonerotate(my, "canon", testvec.x);
        wait(1);
    }
}



untested, but I believe this works...

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: How to combine x,y,z,pan,tilt,roll in one element ? [Re: Toon] #341372
09/15/10 16:05
09/15/10 16:05
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
Try this:
Code:
typedef struct
{
	var x, y, z;
	var pan, tilt, roll;
} MY_VECTOR;



and just replace "VECTOR testvec" with "MY_VECTOR testvec".

Re: How to combine x,y,z,pan,tilt,roll in one element ? [Re: Saturnus] #341373
09/15/10 16:15
09/15/10 16:15
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i think a struct is a bad idea
it wont work, because the engine doesn't use pan tilt roll or x y z, it only uses the memory allocated by the size of three vars!
you can also write this:
Code:
function act_canon()
{
    VECTOR temp;
    VECTOR testvec;
    
    while(1)
    {
        vec_set(temp.x, you.x);
        vec_sub(temp.x, testvec.x);
        vec_to_angle(testvec.x, temp.x);
        
        ent_bonerotate(my, "canon", testvec);
        wait(1);
    }
}



you only need the .x if you use any sort of struct like an entity or view!
ao the code with the defined struct won't work!


Visit my site: www.masterq32.de
Re: How to combine x,y,z,pan,tilt,roll in one element ? [Re: Saturnus] #341375
09/15/10 16:25
09/15/10 16:25
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Thanks for reply, i tryed that too but it didnt work either...is it possible that i'm doing something wrong with the bone function? grin

Re: How to combine x,y,z,pan,tilt,roll in one element ? [Re: MasterQ32] #341377
09/15/10 16:56
09/15/10 16:56
Joined: Nov 2003
Posts: 433
The Netherlands
T
Toon Offline OP
Senior Member
Toon  Offline OP
Senior Member
T

Joined: Nov 2003
Posts: 433
The Netherlands
Thanks for reply but the canon keeps spinning real fast,

i tried it with the function below to test and see what the targets where...

none of the targets are moving so the canon should now face the closest target but it just spins like > crazy

Code:
action act_boat()
{
    VECTOR temp;
    VECTOR testvec;
    
    while(1)
    {
        if(!you)
        {
            c_scan(my.x,my.pan,vector(360,360,10000),SCAN_ENTS | SCAN_LIMIT | IGNORE_ME | IGNORE_FLAG2);
            beep();
            wait(-1);
        }
        else
        {
            if(key_del == 1)
            {
                beep();
                ent_remove(you);
            }
            else
            {
                vec_set(temp.x, you.x);
                vec_sub(temp.x, testvec.x);
                vec_to_angle(testvec.x, temp.x);
                ent_bonerotate(my, "canon", testvec);    
            }
        }
      wait(1);
    }
}



Re: How to combine x,y,z,pan,tilt,roll in one element ? [Re: Toon] #341395
09/15/10 20:36
09/15/10 20:36
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
have a look at ent_bonereset(), each bone rotate is adding to it's previous rotation


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