Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 8th Mar 2019 11:35
Here is my implementation for a simple 3D move gizmo
The main file:


and the include file

I hope it will be useful to someone
nonom
AGK Developer
1
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Aden
Posted: 8th Mar 2019 13:23
Woah george++!!!. It will be quite useful

Thanks for sharing, It works flawless
hendron
3
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 8th Mar 2019 20:05 Edited at: 8th Mar 2019 21:07
Nice work. Just a suggestion, as I ran into this issue myself with a map editor I'm working on. Since you're using 2D to render the gizmo, you may want to add in a check to make sure the gizmo and its line points are not behind the camera before allowing it to render or run. Otherwise you'll have an inverted gizmo and some other odd drawing issues when it's behind the camera.
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 8th Mar 2019 23:23 Edited at: 8th Mar 2019 23:55
Very nice work. I was looking for something like that. thanks
I added a gimbal so you can navigate the scene using the mouse.
just realized i forgot zoom. i'll make sure i add that


*EDIT*: Added zoom

project attached

Attachments

Login to view attachments
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 9th Mar 2019 06:03
@hendron: unfortunately, I cannot handle this issue
Nice addition, blink0k, I made a small modification to your code: when the user drags the gizmo the camera navigation is being disabled

Attachments

Login to view attachments
janbo
10
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th Mar 2019 11:49
Nice, put your SyncGimbal() function somewhere above gizmo3D_Update() to remove the delay of the gizmo when moving the camera.
And I don't like inverted camera y movement:


How about rotation via Gizmo using DrawEllipse ?
hendron
3
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 9th Mar 2019 16:52 Edited at: 9th Mar 2019 20:58
@george++ Here you go, a function to check if a world point is behind the camera.





EDIT: Just thought of a much simpler way to do it. Simply check to see if moving the camera forward increases the distance from the camera to the world point. Won't be quite as accurate as the other method, but should work pretty well.

george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 9th Mar 2019 19:51
@hendron: Thank you very much I'll be in home next week and I will take a look at it.
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Mar 2019 03:57
Quote: "How about rotation via Gizmo using DrawEllipse ?"


That sounds like a great idea!. I thought a free movement (relative to the camera) if you dragged the object (Not using the gizmo) would be good too
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 11th Mar 2019 19:34 Edited at: 11th Mar 2019 19:37
You can find a new improved version of the gizmo thanks to you guys!
1. I removed the delay between gizmo and screen navigation
2. I changed the control of the camera. janbo's suggestion fits better to my preferences
3. I used, the built-in command of AppGameKit to detect if the gizmo is inside the screen area. @hendron: Your code snippets are still usefull, but I think the built-in command is faster.
@blink0k: I am not sure if I will manage to detect pointer touch on a 3D ellipse, but I will try later.

Attachments

Login to view attachments
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Mar 2019 01:00 Edited at: 12th Mar 2019 01:12
Quote: "I am not sure if I will manage to detect pointer touch on a 3D ellipse, but I will try later."


I was thinking about that and maybe if you draw a small circle at the end of your axis lines. If they click and drag those then the object rotates around the appropriate axis

ps: looks awesome george.
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 12th Mar 2019 10:11
Thank you blink0k. A small circle at the end of the handle (one for each axis), it is a good idea and easy (I think) to implement
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 14th Mar 2019 15:54
Hi guys,
I've attached an optimized version of the gizmo but, sorry, without rotation skills
I started this just for fun and there is no good base to add rotation handles. Unfortunately I don't have enough time to start from scratch.

Attachments

Login to view attachments
blink0k
AGK Developer
Gold Codemaster
6
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Mar 2019 20:48
Superb george!
Rotation and drag handles look awesome.
Question with drawing the gizmo: If i use SetViewOffset() to move the camera will the handles still be drawn?
george++
12
Years of Service
User Offline
Joined: 13th May 2007
Location: Hellas
Posted: 15th Mar 2019 01:20
Thank you blink0k. I suppose it will work since all the handles are being translated from 3D to screen coordinates. But it should be tested

Login to post a reply

Server time is: 2019-05-21 20:54:27
Your offset time is: 2019-05-21 20:54:27