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.

AppGameKit Classic Chat / Dragging Object

Author
Message
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 6th May 2018 16:56
Hello forum,

I have one question: Does anyone know how can select an object with the mouse pointer and drag it along? (Something like dbpro had "pick object")

Thank you!
www.alexmatei.com
puzzler2018
User Banned
Posted: 6th May 2018 16:58 Edited at: 6th May 2018 16:59
Hello

Furparpk made some nice snippets and this is in there too, under the heading

moving a 3D object in 3D Space with Mouse

https://forum.thegamecreators.com/thread/222027

Hope AppGameKit treats you well
MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 6th May 2018 17:36 Edited at: 6th May 2018 17:36
Hi Puzzler,

That's indeed what i needed for dragging the object!
But if i have multiple objects on the and want ro select them, how do i do that?

Big thank you!

Edit: yes, AppGameKit is every programmer's dream!
www.alexmatei.com
puzzler2018
User Banned
Posted: 6th May 2018 17:41
Im not 100% sure at the moment, I will be doing exactly what you wishing to do on our Minecraft thread...

But rather than moving a block like you wishing to do, i will be selecting objects for deleting or adding blocks instead.

but can use this, to identify the object to then use the one Furbaprk uses

I will be coding something up during this and next week,so once I have found how to select an object, then will advise

GetObjectRayCastX
GetObjectRayCastY
GetObjectRayCastZ


is where you should be heading anyway

MateiSoft
11
Years of Service
User Offline
Joined: 22nd Oct 2012
Location:
Posted: 6th May 2018 17:55 Edited at: 6th May 2018 18:02
ok so if i place the object that is always with the mouse and click when i am near to an object, i can retrieve that object's number that has collided with the main object initally.

I understand.

Please notice one thing regarding the example given that the object is not correctly following the mouse when the camera is at a certain position. Am i right?

Thank you!

EDIT: Here is the demonstration -> https://youtu.be/rthGIU4VxnU
www.alexmatei.com
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 6th May 2018 21:50
@matesoft you could try and attach the objects with FixObjectToObject( objID, toObjID ) its a bit tricky to use
As the object being fixed uses its current position, rotation, and scale as an offset to the parent.

Quote: "Please notice one thing regarding the example given that the object is not correctly following the mouse when the camera is at a certain position. Am i right?"

The problem is 3d space has 3 vectors a mouse can only have two Vectors x and y in the above example y is replaced with the z axis

but modifying these values


in this function should give you a better mouse movement it is dependant on the resolution you have selected aswell

fubar

Login to post a reply

Server time is: 2024-03-28 10:32:12
Your offset time is: 2024-03-28 10:32:12