im trying to make a katamari-like game, but im not sure how to make objects stick to eachother on contact like in the games. a few programs work but the objects still move while stuck on the object. so how do i just make it stiff and stay in the spot it was picked up in?
Use the Sticker extension. Add it as a behaviour for the object you want to stick. When you have a collision, use the Stick action to join the two objects.
Yes, although for something I did recently, the sticker extension didn’t give enough control.
For example, if I do this:
So if the green circle moved to the pink hat from a different direction other than from directly below then it wouldn’t be a hat, but just a pink triangle stuck to a green circle.
And if I wanted the green circle to 'carry' the triangle within its boundaries then the collision sticker combination could not give this result:
So, milk, I guess how you want your sticking to look affects the solution. The object stuck on the outer edge or within? And from a quick image search of Katamari, you probably want the second option?
yea. kind of like the “pin” feature in construct 3
From what you’re wanting to do, it really sounds like you should just use the “put an object around another” event.
ObjectA is in collision with ObjectB | Link ObjectA with ObjectB
Trigger Once | Set Variable "Distance" of ObjectB = ObjectB.Distance(ObjectA)
| Set Variable "RotAngle" of ObjectB = ObjectA.AngleToObject(ObjectB)
For each ObjectB
Take into account all ObjectA linked with ObjectB | Put ObjectB around ObjectA at ObjectB.Variable(RotAngle)+ObjectA.Rotation() degrees and ObjectB.Variable(Distance)
Those two events should do what you need. The first event tracks the collision distance + angle. The second event ensures the position of Object B stays around Object A, and it keeps Object A’s rotation in account.
Here’s a quick example of an object stuck already with this logic:
is the variable a scene or global variable?
Neither. It’d be an object variable since you want it on every instance that ends up connecting to your other object.
This is what the sticker extension pretty much does, but without the need for the dev to keep track of it.
Another option, if you’re using physics, is to use a weld joint.