Laser Ray
by yurembo · in Torque 2D Beginner · 03/22/2014 (11:28 am) · 6 replies
Hello everyone!
How to make a laser ray from a defined point to the bounds of the screen with a correct angle?
How to make a laser ray from a defined point to the bounds of the screen with a correct angle?
About the author
Torque fan
#2
github.com/GarageGames/Torque2D/blob/development/modules/AngleToy/1/main.cs
03/23/2014 (12:29 am)
The AngleToy in the development branch also shows off some methods to draw lines depending on the cursor location.github.com/GarageGames/Torque2D/blob/development/modules/AngleToy/1/main.cs
#3
One more question:
How to find coordinates of a destination point in some distanse of a source point in which direction this looks up?
03/23/2014 (1:00 am)
Thank you, guys, so much!One more question:
How to find coordinates of a destination point in some distanse of a source point in which direction this looks up?
#4
03/23/2014 (1:33 am)
Can particles collide with other objects?
#5
b) Particles cannot collide with other objects. I suggest that you check out Liquidfun, which adds Box2D particle collisions and other neat stuff, such as fluid simulation.
Bear in mind though that even though this system adds collidable particles, it does not tie in automatically to the existing T2D particle effects system.
03/23/2014 (3:05 am)
a) trignonometry is your friend and it's way too early in the day for me to answer that coherently.b) Particles cannot collide with other objects. I suggest that you check out Liquidfun, which adds Box2D particle collisions and other neat stuff, such as fluid simulation.
Bear in mind though that even though this system adds collidable particles, it does not tie in automatically to the existing T2D particle effects system.
Torque Owner practicing01
MourningDoveSoft
In a pseudo-nutshell:
1) Sprite_Laser.setSize( Vector2Distance( Vec2D_Laser_Origin, Vec2D_Laser_Target ) )
2) Float_Angle= Vector2AngleToPoint( Vec2D_Laser_Origin, Vec2D_Laser_Target )
3) Sprite_Laser.Angle= Float_Angle
//The following is to offset because sprite origins are at the center, not top-left
4) Vec2D_Projected_Offset= Vector2Direction( Float_Angle, Laser_Size / 2 )
5) Sprite_Laser.Position= Vector2Add( Vec2D_Laser_Origin, Vec2D_Projected_Offset )