Answered
0
0

Is it possible to make an object stick to another object when it collides with that object?

For example...

I have a jumping ball (character), it hits a square and sticks to the square.

When the square is tapped on, it should release the ball.

I've played around with actions a little and linking a little, but can't seem to see how to do this.

Logic seemed like a good start, but that didn't seem to be able to achieve this either.

Thanks,

Mojpoj

  • You must to post comments
Great Answer
0
0

I may have found a solution with some more tinkering.  Only using for a couple days so bear with me.

I put a very thin "Action" object on top of the "magnet".  When the action is collided with, the action changes "game play" and sets the character speed to zero.

I also have the "magnet" start moving (collision based).

This seems to work to stop the ball from moving, but I can still jump, and if I jump, the magnet moves but the ball doesn't move with it.  Played a little with air drag and friction settings, but no luck.

Setting the actions"Jump Force" to zero kind of works.   Now the ball cannot move in any direction, and it can't jump.  I can work with that, but there are two things I would like to achieve...

  1. I would like the ball to be able to jump, but stay moving with the magnet (linear on the x or y plane) without falling off after a couple jumps.
  2. I would like the changed "game play" properties to stay in effect until the magnet or ball touches another action item.  Right now, it appears time based is the only option.  I tried setting to zero (thinking infinite), but it actually means the changes never take place (zero seconds).

This could make for some very interesting possibilities.  With characters getting locked to things and the player just hanging on for the ride as the game takes over briefly.  Thinking of something like a player hitting a hidden jet pack and shooting through a couple scenes.  Or making a scene that is developer created as a bonus or post boss screen.  Lots of uses, you get the idea.

Maybe someone has a better way to do it, this is just what I came up with after tinkering for a couple hours.

Mojpoj

  • mojpoj
    Since no one else has a better solution, I'm guessing this is the best. I'll mark as solved, but please advise if there is a better way. Thanks.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.