[solved] move object with speed and angle of another object

0 favourites
  • 7 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Each wooden disk in my game moves around at random angles and random speeds. The ball rolls from disk to disk.

    Right now, the ball doesn't move with the speed and angle of the disks. If the device is not being tilted the ball will stay in that position, and the disk will continue moving at its current speed and angle, leaving the ball at its current position.

    How can i move the ball at the speed and angle of the disk that it rolls onto, if there is no tilt registered?

    Pin doesn't work, there's a fraction of lag between the tilt and the ball movement.

    Can someone please help. It will be greatly appreciated.

  • Still trying to figure this one out. No examples or tutorials. Old posts have dead links.

    Open for suggestions.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can rotate a point around another using a formula like the one here:

    https://www.siggraph.org/education/mate ... 2drota.htm

    And here's a cursory example of that applied:

    https://dl.dropboxusercontent.com/u/542 ... otate.capx

    You could probably do it with less math, but I'm not feeling especially creative.

  • Thank you for the reply R0J0hound but that's not what i need.

    Example: if you are pulling a little red wagon and a squirrel runs and jumps onto that little red wagon and stops, the squirrel's angle and speed will change to that of the little rd wagon.

    My wooden disks move at random angles and speeds. The player must tilt the device to roll the ball around while staying on top of these disks. If he falls off the edges of the disks, it's game over.

    Right now, if the player is on top of a disk and stops tilting the device the ball stops moving, it stays in that exact X and Y location while the disk keeps moving on its current path, and does not move again until the player tilts the device to move the ball again.

    capx example https://www.dropbox.com/s/6t3i4sr6obi0sde/Ball%20on%20Sq_001.capx?dl=0

    I need it so if the ball is on top of a disk and the player stops titling the device, the ball will continue to move with the disk. I'm sure it has to do with something like:

    Ball - overlapping disk

    Touch -gamma is 0 > ball - set speed to disk.bullet.speed

    Ball - overlapping disk

    Touch -gamma is 0 > ball - set angle to disk.bullet.angle

    Or something like that. I just can't find any posts, examples or tutorials and i can't figure this out.

  • Just added a capx example with tilt and keyboard support, to get a better understanding of what i mean.

  • With a capx, i understand the question.

    https://www.dropbox.com/s/tuacfqmdl89ao ... .capx?dl=0

  • 99Instances2Go

    I was so worried i wouldn't be able to figure this out, making me rethink and edit almost my whole game. Exactly what i needed.

    I LOVE YOU

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)