Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Grant, AndrewAMD), 911 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
mouse_dir3d in ISOMETRIC mode wont work well #298451
11/15/09 05:49
11/15/09 05:49
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
To get a mouse position in the isometric world, vec_for_screen is still usable, though I believe very slightly off.


Click and join the 3dgs irc community!
Room: #3dgs
Re: mouse_dir3d in ISOMETRIC mode wont work well [Re: Joozey] #298593
11/16/09 09:48
11/16/09 09:48
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
That's probably indeed a bug. I'll look into this - it will be fixed in the next update.

Re: mouse_dir3d in ISOMETRIC mode wont work well [Re: jcl] #298876
11/18/09 16:38
11/18/09 16:38
Joined: Feb 2006
Posts: 52
C
carlpa Offline
Junior Member
carlpa  Offline
Junior Member
C

Joined: Feb 2006
Posts: 52
The vec_for_screen is more than slightly off. The degree of error seems to depend on the (world) distance between the object and the camera. I assume this is due to the fact that ISOMETRIC "flattens" what is a curved surface. The greater the distance from the camera, the larger the distortion due to flattening. The screen is the plane stretched to fit on the curved world surface. Hence, the "error" in using ISOMETRIC. One fix wculd be a function which takes the values generated by vec_for_screen and automatically makes the correction.


Researcher & clinician. A6, A7, & A8
First computer a Commodore Pet
Re: mouse_dir3d in ISOMETRIC mode wont work well [Re: carlpa] #299519
11/24/09 15:41
11/24/09 15:41
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Yes, vec_for_screen is a perspective calculation and can not be used for isometric views, but I can not confirm a problem of mouse_dir3d, at least not with my test levels.

Can you upload the project where this happens, or send it to Support? We'll look into it.

Re: mouse_dir3d in ISOMETRIC mode wont work well [Re: jcl] #299556
11/24/09 21:30
11/24/09 21:30
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Sure, stripped down: http://www.joozey.nl/resource/storage/3dgs/forum%20host/moused3d_isometric.rar

I run it in windowed mode from SED. My screen has a resolution of 1280x800.
The zoom function has no influence on the accuracity as far as I know.


Click and join the 3dgs irc community!
Room: #3dgs
Re: mouse_dir3d in ISOMETRIC mode wont work well [Re: Joozey] #299587
11/25/09 07:34
11/25/09 07:34
Joined: Jul 2000
Posts: 27,935
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,935
Frankfurt
Thanks, but I can't confirm a wrong mouse_dir3d in your level either.

You're probably thinking this because you're doing a trace from the camera to the extended mouse position. The trace line has a different direction than mouse_dir3d, and ends up at a different position. But that is just logical in an isometric view.

Just remove the trace code and you'll see that mouse_dir3d is correct.

Re: mouse_dir3d in ISOMETRIC mode wont work well [Re: jcl] #299742
11/26/09 15:49
11/26/09 15:49
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Ah yes, that makes sense. Thanks!

If people stumble on the same problem, this works:
Code:
VECTOR mouse_click;

void mouseTo3D() {
	while (1) {
		if (mouse_left) {
			
			vec_set (mouse_click, mouse_dir3d); //get direction vector from mouse to world
			vec_normalize(mouse_click, 4000); //give it a large distance for tracing
			vec_add (mouse_click, mouse_pos3d); //calculate from camera mouse in 3d position
		
			c_trace (mouse_pos3d, mouse_click, IGNORE_MODELS); //trace from isometric 3d mouse position to clicked position (= mouse position + 4000 in depth)
			
			vec_set( mouse_click, target );
			ent_create ("warlock.mdl", mouse_click, NULL); //accurate warlock placement!
			
		}
	wait(1);
	}
}




Click and join the 3dgs irc community!
Room: #3dgs

Moderated by  HeelX, Spirit 

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