Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
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
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Quad, VoroneTZ, 1 invisible), 862 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Need help with 3D Cursor #388429
12/02/11 20:15
12/02/11 20:15
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hi there

i´ve a little problem with my Editor..
I want to change from keyboard controls, to mouse control.

Problem.. i´ve no clue how to set the 3D Block on the position of the mouse ._.

c_trace isn´t working, cause there´s nothing the trace can hit...

That´s how the Editor looks like:


This yellow transparent block is the 3D Cursor, the small thingy right is the mouse cursor.
The Grid is drawn with draw_line3d.

The Editor View is a Second view (not the camera) called "edit_view".


The Block should move on his X and Z Axis.. BUT NOT on his Y. Cause the Y position will be changed with the Mouse Wheel.


Can someone help me here? ._.

Last edited by Espér; 12/02/11 20:26.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Need help with 3D Cursor [Re: Espér] #388444
12/02/11 23:19
12/02/11 23:19
Joined: Feb 2011
Posts: 135
Myrkling Offline
Member
Myrkling  Offline
Member

Joined: Feb 2011
Posts: 135
If I understood you correctly, this code might help you getting along: http://www.opserver.de/wiki/index.php/Plane-Line_Intersection

You can construct a ray/line through the mouse cursor with mouse_dir3d and mouse_pos3d. The grid acts as a plane. You can then place the cube at the intersection point.

Re: Need help with 3D Cursor [Re: Myrkling] #388600
12/04/11 21:38
12/04/11 21:38
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
uhm.. what?
Didn´t get it ._.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Need help with 3D Cursor [Re: Espér] #388603
12/04/11 21:46
12/04/11 21:46
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
What Myrkling suggests is that you check if the imaginary line from the mouse cursor to some hypothetical position far in front of the mouse cursor, and check if and where it intersects with your grid.

If you also want to check if an entity is hit, you should first c_trace() along the line and if it hits nothing fall back to the intersection check.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Need help with 3D Cursor [Re: WretchedSid] #388608
12/04/11 22:08
12/04/11 22:08
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
and how can i check that intersection with the grid?


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Need help with 3D Cursor [Re: Espér] #388612
12/04/11 23:25
12/04/11 23:25
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Dude, he posted a link with working code and everything oO


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Need help with 3D Cursor [Re: WretchedSid] #388614
12/04/11 23:54
12/04/11 23:54
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Why don't you simply add a plain terrain at the height of the grid, and then use a trace with mouse_pos3d and mouse_dir3d like the example from the manual?

http://www.conitec.net/beta/mouse_pos3d.htm

As soon as the player places a Terrain, he wants to place the things at the height of the hills or valley anyway.

Re: Need help with 3D Cursor [Re: Pappenheimer] #388626
12/05/11 09:11
12/05/11 09:11
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
yes, but what do i need to fillin plane_point or plane_normal or ip?

i tried a terrain, but when i moved it with the camera to the sides and up and down, the framerate was killed..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Need help with 3D Cursor [Re: Espér] #388630
12/05/11 10:38
12/05/11 10:38
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Espér
yes, but what do i need to fillin plane_point or plane_normal or ip?

I... are you kidding us?

Quote:

// line_from First arbitrary point on the line.
// line_to Second arbitrary point on the line (must not be equal to line_from).
// place_point Arbitrary point on the plane.
// plane_normal Surface normal of the plane.
// ip [out] Vector to be set to the intersection point. May be NULL.



Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Need help with 3D Cursor [Re: WretchedSid] #388631
12/05/11 10:38
12/05/11 10:38
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
i´ve no plane ._.
the room is complete empty..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
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