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.

DarkBASIC Professional Discussion / Grabbing objects? [glue/unglue]

Author
Message
Tucker
16
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 14th Nov 2010 02:13
Hey guys again.
Im having some issues with the glue/unglue commands.
The object that glues to the player object randomly gets placed somewhere different every-time I use the command.
How do I get the glued object to glue to a certain place everytime?
And then when unglued, set it in front of the player?

If you want to try implement it, and see if it happens on your compiler, just ask for the code.

Any help would be great!

Hey look at that!
Mugen Wizardry
User Banned
Posted: 14th Nov 2010 02:22
i could try it for u

send me the code

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Tucker
16
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 14th Nov 2010 02:36
Alright, I attached the player objects that you will need.



I've been trying to get it so when spacebar is pressed, the cube appears above the player, on their head.
And when the spacebar is released, it drops it in front of them.
Also, would you know how to make it so when the player touches one of the cubes and presses space, that cube is glued to the player?

Thanks for helping out!

Hey look at that!
Mugen Wizardry
User Banned
Posted: 14th Nov 2010 02:45
dont i need all the objects and images too?

i cant load it without that.

and no problem

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Tucker
16
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 14th Nov 2010 02:54
The only thing you should need is that model attached to my earlier post.
I forgot to mention it uses sparkys.
just comment out any external file you need, except for the stan model and it should run?

Hey look at that!
Mugen Wizardry
User Banned
Posted: 14th Nov 2010 05:59
i know the problem.

its because you are trying to glue the object to a pivot which is moving all the time and has the wrong 3d coordinates.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 14th Nov 2010 06:11
this is as close as i can get.



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Tucker
16
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 14th Nov 2010 06:24
the randomize hitimer is giving back syntax errors?

Hey look at that!
Tucker
16
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 14th Nov 2010 06:27
How about making it, if the character touches a block, and holds spacebar, the block dissapears, and then if the spacebar is let go, the block is dropped where the player currently is?

I've been trying for hours, and about to throw my laptop out the window.

Hey look at that!
Mugen Wizardry
User Banned
Posted: 14th Nov 2010 06:30
o. u need ianm's plugin for the hitimer


just change it back to regular timer()


now THATS much easier

1 moment.

i'll try 1 more time.

but im tired.

LOL

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 14th Nov 2010 07:01
best i can do.



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Tucker
16
Years of Service
User Offline
Joined: 20th Jun 2010
Location: Earth Prime
Posted: 14th Nov 2010 07:10
not working

Ill try figure something out.
Thanks for the help anyway!
Cheers

Hey look at that!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Nov 2010 15:57
I have a glue object to object function but it uses EZ rotate:


This will glue the object in the correct place for you...

If you don't have EZRo think about it like this:
You need to add the limb rotation and offset from the object/limb you are going to glue to onto your object to be glued's current rotation and position before glueing it.

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Nov 2010 17:16 Edited at: 15th Nov 2010 17:18
The glue object command will glue object 2 to object 1, but offset it by whatever position object 2 is at.

For example, if object 1 is at 0, 0, 0, and object 2 is at 0, 10, 20, once glued it will be at 0 + 0, 0 + 10, 0 + 20.

If object 1 is at -10, 10, 20, and object 2 is at 0, 10, 20, once glued it will be at -10 + 0, 10 + 10, 20 + 20.

you need to find the difference in position between both objects, then glue them whilst the main object is at 0, 0, 0 to ensure that the final positions are correct.

Oh, and for some reason, I've found that the Y position is inverted for some reason.

*edit* Doesn't really make sense in this post does it?

My signature is NOT a moderator plaything! Stop changing it!
Mugen Wizardry
User Banned
Posted: 15th Nov 2010 17:23
Quote: "For example, if object 1 is at 0, 0, 0, and object 2 is at 0, 10, 20, once glued it will be at 0 + 0, 0 + 10, 0 + 20.

If object 1 is at -10, 10, 20, and object 2 is at 0, 10, 20, once glued it will be at -10 + 0, 10 + 10, 20 + 20"


function Get_Difference(X1#,Y1#,Z1#,X2#,Y2#,Z2#)
GLUEX# = X1#+X2#
GLUEY# = Y1#+Y2#
GLUEZ# = Z1#+Z2#
FINALGLUE# = GLUEX#+GLUEY#+GLUEZ#
endfunction FINALGLUE#

Someone please feel free to correct my math

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Nov 2010 17:35 Edited at: 15th Nov 2010 17:40
Unsure why you add them together? My post was to point out if your objects are at origin 0, 0, 0 and 10, 10, 10 they will glue correctly. If your objects origin is at 100, 100, 100 and 110, 110, 110 they will glue incorrectly. (Even though the offset between both objects are the same, it will add the position of the gluing object to the glued object, rather than just gluing them, it will offset the second object according to it's world position)

Erm... I'm failing in my explanations again! lol

A better example would be to create two objects. One at 100, 100, 100, and the other at 110, 110, 110.

You'd expect after gluing that object one would be at 100, 100, 100, and the newly glued object would have a limb position of 110, 110, 110. But it doesn't. It will add the world position of object 2, to the world position of object 1, meaning object 2 will have a limb position of 210, -210, 210. (And the Y position will be inverted) Which is wrong.

*edit* correction, the y position isn't inverted, it just expects the object axis to be X/Z/Y, not X/Y/Z

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2026-07-23 02:37:35
Your offset time is: 2026-07-23 02:37:35