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
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 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
Why GameStudio make it so hard with vectors? #276034
07/03/09 09:40
07/03/09 09:40
Joined: Jun 2009
Posts: 8
A
Andrei Offline OP
Newbie
Andrei  Offline OP
Newbie
A

Joined: Jun 2009
Posts: 8
Ok it seems im too stupid to understand vectors in 3DGS or maybe they make it so hard that only a few can understand them.
I hope someone can help me with some vectors scripts,because right now im starting to regret that i spend all this money on this program smile
So, this is what im trying to do:
i have a platform with 9 holes in it from which 9 models appear
i have a hammer above camera so is not visible all the time but it have the same x, y coord as the camera and the z+50
when a model appear from a hole and i click it with the mouse i want my hammer to move from his position to model position on a circle arc and hit that model
and here my problems start:i cant make that hammer to move on a circle arc in 3D space :(((.Ive read the manual, online tutorials but all are only for 2D moves and i cant adapt to 3D moves
PLS help :))
thx

Re: Why GameStudio make it so hard with vectors? [Re: Andrei] #276039
07/03/09 09:52
07/03/09 09:52
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
hopfel Offline
User
hopfel  Offline
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67"...
Is this that what you want?

hammer.x+=(circle.x-hammer.x)*time_step;
hammer.y+=(circle.y-hammer.y)*time_step;


Hilf mir, dir zu helfen!
Re: Why GameStudio make it so hard with vectors? [Re: hopfel] #276070
07/03/09 10:39
07/03/09 10:39
Joined: Jun 2009
Posts: 8
A
Andrei Offline OP
Newbie
Andrei  Offline OP
Newbie
A

Joined: Jun 2009
Posts: 8
basicaly what i want to do is to move a model from A(x1,y1,z1) to B(x2,y2,z2) on a circle arc in 3D space
Thx for your replay, ill try to include that to my script and include the z coord too :), i hope it will work smile

Re: Why GameStudio make it so hard with vectors? [Re: Andrei] #276078
07/03/09 10:55
07/03/09 10:55
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
Its more a math problem, than some functionality that should
be provided by the engine.

A simple sollution to your problem would be to make te hammer-model,
extend the origin-point of the model some way off the shaft,
and then simply lett the hammer model tilt down 90 degrees.

So you only ROTATE the hammer-model.

This way the hammer would move on a quarter circle path, just like
slamming a hammer on a forge.

Re: Why GameStudio make it so hard with vectors? [Re: Damocles_] #276218
07/03/09 20:56
07/03/09 20:56
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
any chance of uploading an image of what you're after with which parts you need to rotate, or ideally a video of it working in another game?

Re: Why GameStudio make it so hard with vectors? [Re: MrGuest] #276264
07/04/09 04:04
07/04/09 04:04
Joined: Dec 2008
Posts: 528
Wagga, Australia
the_mehmaster Offline
User
the_mehmaster  Offline
User

Joined: Dec 2008
Posts: 528
Wagga, Australia
you could rotate it, and at the same time make it go forward RELATIVE to the angle. this should work.

Re: Why GameStudio make it so hard with vectors? [Re: the_mehmaster] #276307
07/04/09 11:59
07/04/09 11:59
Joined: Jun 2009
Posts: 8
A
Andrei Offline OP
Newbie
Andrei  Offline OP
Newbie
A

Joined: Jun 2009
Posts: 8
MrGuest here is the picture u want. I hope u cen see the link its my first time when i upload something :)))
http://www.2shared.com/file/6555109/9fd5367f/IMAG0034.html

Anyway here is the code ive done so far but is not working

entity* MainObject;
var distance;
var tempo;
var temp_dist;
var angle1;
var angle2 = 90;
string target_mdl = "hammer.mdl";
bmap mouse_pointerr = <cursred.bmp>;



action CameraPoint
{
MainObject = me;
my.invisible = on;
my.passable = on;

}

function Camera_Init()
{
wait(10);
while(1)
{
camera.z = MainObject.z + 10;
camera.x = MainObject.x;
camera.y = MainObject.y;
camera.pan = MainObject.pan;
camera.tilt = MainObject.tilt;
camera.roll = MainObject.roll;
wait(1);
}
}

function adjust_target()
{
vec_diff (temp,nullvector,target);
vec_to_angle (my.pan,temp);
}

function create_target()
{
var pos1;
var pos2;
pos1.x = mouse_pos.x;
pos1.y = mouse_pos.y;
pos1.z = 5;
vec_for_screen (pos1,camera);
pos2.x = mouse_pos.x;
pos2.y = mouse_pos.y;
pos2.z = 20000;
vec_for_screen (pos2,camera);
c_trace (pos1,pos2,IGNORE_PASSABLE);
distance = vec_length(target);
tempo.x = 0;
tempo.y = 0;
tempo.z = distance;
tempo.tilt = 0;
tempo.roll = 0;
ent_create (target_mdl,tempo,adjust_target);
wait(1);
angle1 = vec_to_angle (my.pan,temp);
vec_set(temp,nullvector);
while (angle2 > 0 )
{
temp_dist = cos(angle2)*distance;
temp.x = cos(angle1)*temp_dist;
temp.y = sin(angle1)*temp_dist;
temp.z = sin(angle2)*distance;
angle2 -=2*time;
c_move (target_mdl,temp,nullvector,IGNORE_PASSABLE);
wait(1);
}
}



function mouse_startup()
{
on_mouse_left = create_target;
mouse_mode = 2;
mouse_map = mouse_pointerr;
while(1)
{
vec_set (mouse_pos,mouse_cursor);
wait(1);
}
}


Well not all the code lines belong to me ,:)) some of them i copy/paste from others

Last edited by Andrei; 07/04/09 12:04.
Re: Why GameStudio make it so hard with vectors? [Re: Andrei] #276423
07/04/09 23:49
07/04/09 23:49
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!


If the action around the 9 holes is always the same you could
make a path in WED ...place a node at every hole and then
slide from one node to the other when you click on the mouse.


Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: Why GameStudio make it so hard with vectors? [Re: Ottawa] #277679
07/10/09 06:37
07/10/09 06:37
Joined: Jun 2009
Posts: 8
A
Andrei Offline OP
Newbie
Andrei  Offline OP
Newbie
A

Joined: Jun 2009
Posts: 8
I discovered how to move an object in 3D smile.Long live Google smile
By using matrix and quaternion, still too complicated for me smile so ill stick with 2D movement,its a lot easy and not soo complicated to program with C-Script
Thx for your replay

Re: Why GameStudio make it so hard with vectors? [Re: Andrei] #277691
07/10/09 08:05
07/10/09 08:05
Joined: Feb 2005
Posts: 3,687
Hessen, Germany
T
Tempelbauer Offline
Expert
Tempelbauer  Offline
Expert
T

Joined: Feb 2005
Posts: 3,687
Hessen, Germany
to move an object in gs is easier than in other systems.
as i remember right, in opengl you have to draw your world again with new coordiantes of the object. in gamestudio the engine do it. you just have to call c_move or change the corrdiantes.
a translation-matrix isnt so complicated wink
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
just multiply it with the current world-matrix
more complicated are rotaions :p


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