Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
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
3 registered members (kzhao, AndrewAMD, bigsmack), 824 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Creating a move gizmo #289057
09/10/09 09:26
09/10/09 09:26
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Hi, you know how in modelling applications you can move/rotate/scale objects using something called a "gizmo".

I was just wondering what is the best way to create one of those that works like professional apps. I've started developing a level editor for 3DGS Easy Scripter and so i want to make a good working gizmo. Right now i have 3 arrow models attached to the origin on a model, pointing in each direction.

Would it be best to move it using events like EVENT_TOUCH together with mouse_force or would tracing from the camera be a better solution.

I'm just interested in hearing your ideas.

Thanks, DJB.

Re: Creating a move gizmo [Re: DJBMASTER] #289059
09/10/09 09:39
09/10/09 09:39
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I used mouse_ent:
http://www.conitec.net/beta/amouse_ent.htm

If you want to have a look at some code to get further ideas, there is a free ingame editor in the contributions thread, you can have a look at its code, copy and past etc. It is a bit cumbersome, but it could give you a start.

Re: Creating a move gizmo [Re: Pappenheimer] #289133
09/10/09 17:21
09/10/09 17:21
Joined: Aug 2008
Posts: 133
Sweden, Stockholm
E
Enduriel Offline
Member
Enduriel  Offline
Member
E

Joined: Aug 2008
Posts: 133
Sweden, Stockholm
I believe DJBMaster wants to know how to make the algorithm for moving objects with a gizmo like the pro 3D packages, aka how much it should move to left or right when dragging with the mouse etc.

Re: Creating a move gizmo [Re: Enduriel] #289418
09/12/09 19:41
09/12/09 19:41
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
I think the best way would be using mouse_pos3d or mouse_dir3d. I thought mouse_pos3d gave you the 3D coordinate of the mouse, so i tried setting the entity's position to that but it flies to a random position.

Are their any more examples of creating a transform gizmo?

Re: Creating a move gizmo [Re: DJBMASTER] #289434
09/13/09 00:51
09/13/09 00:51
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Didn't know mouse_pos3d before.
Maybe, you could move an entity parallel to the view the following way:

Code:
function move_with_mouse() 
{  
  VECTOR to;
  if(mouse_left&&mouse_ent)
  {
    set(mouse_ent, TRANSLUCENT);
    set(mouse_ent, LIGHT);
    vec_diff(to, mouse_ent.x, mouse_pos3d);
    vec_add(to,mouse_pos3d);
    vec_set(mouse_ent.x, to);
  }
}



Re: Creating a move gizmo [Re: Pappenheimer] #289438
09/13/09 01:25
09/13/09 01:25
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
I couldn't even get the arrow to drag when i used the code above, lol. I think i'm on to something though...



Last edited by DJBMASTER; 09/13/09 01:38.
Re: Creating a move gizmo [Re: DJBMASTER] #289455
09/13/09 08:24
09/13/09 08:24
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Sorry, didn't mention that it is completely untested.

Re: Creating a move gizmo [Re: Pappenheimer] #289548
09/13/09 22:51
09/13/09 22:51
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
lol, np. I have this so far and it does work, in that i can drag an arrow using the mouse...
Code:
ENTITY* x_arrow; // x direction arrow attached to entity
VECTOR to;

while(1)
{
var distance = c_trace(player.x, x_arrow.x, IGNORE_ME);
vec_set(to, mouse_dir3d);
vec_scale(to, distance);
vec_add(to, mouse_pos3d);

x_arrow.x = to.x;
wait(1);
}


...just seems a little buggy.

Re: Creating a move gizmo [Re: DJBMASTER] #303794
01/02/10 06:23
01/02/10 06:23
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline OP
Serious User
DJBMASTER  Offline OP
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Ressurecting an old post...Anyone got any other snippets or samples that demonstrate this? The above code works but there is a small inaccuracy that I don't understand.

Any help is much appreciated.


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