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.

Newcomers AppGameKit Corner / RTS Selection multi-object 3D

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 23rd Jun 2016 07:08
Hi

I need to select several objects by mouse border (like in a RTS 3D). Do you know how to do that ?

My test (not working) :
AGK2 tier1 - http://www.dracaena-studio.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Jun 2016 09:42
i don't understand the code very well but i think you need a ground plane. then calculate where the mouse intersects with that ground plane and draw your area that way.
anything on the ground plane within your selection area is selected.
does that help?
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 23rd Jun 2016 11:14
Hi BlinkOk

YEs, I use the raycast to move one or several object on a plane. But My matter is I can have flying object, and they aren't on the ground plane ^^. So How to include them in my selection ?
AGK2 tier1 - http://www.dracaena-studio.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Jun 2016 11:30 Edited at: 23rd Jun 2016 11:32
assume their y position is the same as the ground plane when you test for collision. in fact ignore the y position entirely and just use AABB collision based on their x/z footprint
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 24th Jun 2016 11:43
I can't ignore their Y position, I really need to select the object in a X,Y,Z area . It's for my 3D editor, so object can be placed anywhere in x,y,z ^^.
AGK2 tier1 - http://www.dracaena-studio.com
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 25th Jun 2016 12:16
I would project the 3d coordinate of the objects into 2d screen coordinates, like this:



I've also added in code that means it doesn't matter how the player draws the box (from corner to corner).
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Jun 2016 16:56
@29games :
excellent !!! Thank you very much, it's great !
AGK2 tier1 - http://www.dracaena-studio.com

Login to post a reply

Server time is: 2024-05-05 08:52:29
Your offset time is: 2024-05-05 08:52:29