I try to write a code that display a laser effect and i wrote this
but some tube goes out from the cube… and i don’t know if it is deleted by laserCollision method.
proposals to improve the code?
thanks for all!!
PS: the use a interval instead a task to move, is the code improved ?
And if i remove the top and the bottom face of tube ?
On line 72, where you are creating the collision segment collision object, you set the into collide mask. Since the segments are being used as the colliders, you want to set the from collision mask on them, and turn the into collision mask to all off. Like so:
tube_node = tube.attachNewNode(CollisionNode('laserTube'))
tube_node.node().addSolid(CollisionSegment(-2, 0, 0, 2, 0, 0))
You also need to make sure the into collision mask on the cube is set correctly, and that the egg file contains collision geometry.
i find a better solution
use CollisionHandlerQueue with CollisionRay to find the length and position of each beam (a tube for each one)
with 8 laser generator in the screen (look at they together) there’s a 70 FPS
Is there a best solution??
thanks for all!!!