Collisions and Particle Generation

Max3DMax3D Member Posts: 6
edited May 2012 in Working with GS (Mac)
Hi Guys,

I have a question if anyone is willing to help.

I have two actors one being a wall the other is the player controlled actor (by touch), is it possible to find the collision position and angle?

My reason for wanting to do this is that I am currently spawning a particle actor where the collision takes place and would like the particles to emanate from the wall, as though debris are being generated at the point of collision. Hope that makes sense :)

Thanks in advance for any replies.

Max3D

Best Answer

  • GreenHavenGamesGreenHavenGames Posts: 62
    Accepted Answer
    Create two game level variables. collisionX and collisionY

    Player
    Constrain self.positionX to game.collisionX.
    Constrain self.positionY to game.collisionY.

    Horizontal Wall
    If collides with player set particle spawn point (to scene not actor) to game.collisionX

    Vertical wall.
    If collides with player set particle spawn point to game.collisionY.

    Hope this makes sense. You can the add a few pixels either way to adjust the final start position of the particles.

    Good luck,

    Sam

Answers

  • Max3DMax3D Member Posts: 6
    I forgot to mention that I am currently using [vectorToAngle( game.Touches.Touch 1.X + game.camX - self.Position.X , game.Touches.Touch 1.Y + game.camY - self.Position.Y )-90] for the self.Rotation of the player controlled actor [the camera follows the actor]. I am wondering if this could be used as an inverse angle to be applied to the particle spawner, but to be honest I am getting a little lost on the math ;)
  • simo103simo103 Member, PRO Posts: 1,331
    @Max3D ... hope you get help with the question as you asked it ... but thought I would throw in an idea ... any reason not to have the particles come from the moving actor not the wall?
  • Max3DMax3D Member Posts: 6
    Hi simo103, thanks for the idea, I had the particles spawning from the moving actor originally but had the same issue of creating the illusion of the particles being generated at the collision point.

    Unless there was something I was missing that could help me achieve it this way.

    Thanks again,

    Max3D
  • Max3DMax3D Member Posts: 6
    edited May 2012
    Hi Sam,

    Thank you for the info, I attempted as you suggested but the effect still didn't look right though. I have gone back to spawning the particles from the actor and modified the spawn points to better fake the effect.

    Thank you both for your suggestions, this is what I am currently working on if you are interested : http://www.youtube.com/watch?feature=player_detailpage&v=b7b09KwJNJU

    I've made several improvements since this video was made, my next task is to create some kind of NAV points to display the locations of certain elements.

    Thanks again,

    Max3D
Sign In or Register to comment.