Implementing a Laser beam - Collision Support - Need Help

Hey Guys,

I’m having a hard time implementing a laser beam for my latest game. Basically I have a object (Beam Platform) and then the laser as

laserBeam = display.newLine( 240,180, 240,200 )  
laserBeam:setColor( 255, 0, 0, 255 )  
physics.addBody( laserBeam, "static", { density=0.0, bounce=0, friction=0.0} )  

Now what I’m trying to achieve is that the player needs to cut the beam by placing another static object in-front of the beam to allow the player past.

When the “Block” or “SteelPlatform” cuts the beam the beam is suppose to stop at the “Block” or “SteelPlatform”.

No as they are 2 static objects collisions don’t seem to work as they don’t trigger the event.

I cant make one of them dynamic as I don’t want either of them to move

Can this be done another way? eg - via Sensors or via detecting the breaking point of the line?

here is the code that I currently have setup

[code]
laser1 = display.newImageRect( “images/laserGun.png”, 15, 15 )
laser1.x = 240 ; laser1.y = 150
laser1.rotation = 90
laser1.myName = “laser”

physics.addBody( laser1, “static”, { density=5.0, bounce=0, friction=0.5} )
levelGroup:insert( laser1 )

laserBeam = display.newLine( 240,180, 240,200 )
laserBeam:setColor( 255, 0, 0, 255 )
physics.addBody( laserBeam, “static”, { density=0.0, bounce=0, friction=0.0} )
[/code] [import]uid: 40417 topic_id: 11148 reply_id: 311148[/import]

Anyone know a good way of doing this? Still having issues trying to get it working. [import]uid: 40417 topic_id: 11148 reply_id: 40600[/import]

you are going to have problems with this if you want the world to have gravity. As kinematic vs static dont fire a collsion event neither does static vs static as you already know:)

Depends if you game needs gravity or not?

Maybe you could keep them as “static” BUT if you touch them you change the body type allowing you to drag them.

not sure if this is suitable for your needs:)

[import]uid: 66324 topic_id: 11148 reply_id: 40642[/import]

Dear Ade,

If you take a quick look at “Brady’s Adventure” on the app store you will see my game, basically im trying to implement world 3 and in that world I would like to implement lasers.

The game is a physics/puzzle game that is affected by Gravity where you use objects (wood - affected by gravity, steel - not affected and change from kinematic to static once the game is started) to get the robot from one side of the map to the other avoiding dangers

The player is set as dynamic. Basically I would like the player to place the steel object in-front of the beam to cut the beam and allow the player past.

Thanks for the Help. [import]uid: 40417 topic_id: 11148 reply_id: 40647[/import]

Anyone have any idea’s on how else this can be done? [import]uid: 40417 topic_id: 11148 reply_id: 40892[/import]