Hi all,
Im trying to do a laser sight in my game and the way i've got it going so far is to update the position and orientation of a sprite representing the laser sight every cycle. My code for this section is pretty much as is below.
EntityPick(gun,100)
If PickedEntity() > 0 Then
temprot# = 0
If PickedNZ() > 0 Then temprot# = PickedNZ() * -180
PositionEntity gunsprite, PickedX(), PickedY(), PickedZ()
RotateEntity gunsprite, PickedNY() * 90, (PickedNX() * 90) + temprot#, 0
MoveEntity gunsprite, 0, 0, -0.1
EntityAlpha gunsprite, 1
Else
EntityAlpha gunsprite, 0
EndIf
This way that i've set it up works perfectly for all six sides of a rectangular room, but gets really messy when the gunsight falls on a surface that isn't at 90 degree angles. I would appreciate any help with correcting my code.
Many thanks,
Im trying to do a laser sight in my game and the way i've got it going so far is to update the position and orientation of a sprite representing the laser sight every cycle. My code for this section is pretty much as is below.
EntityPick(gun,100)
If PickedEntity() > 0 Then
temprot# = 0
If PickedNZ() > 0 Then temprot# = PickedNZ() * -180
PositionEntity gunsprite, PickedX(), PickedY(), PickedZ()
RotateEntity gunsprite, PickedNY() * 90, (PickedNX() * 90) + temprot#, 0
MoveEntity gunsprite, 0, 0, -0.1
EntityAlpha gunsprite, 1
Else
EntityAlpha gunsprite, 0
EndIf
This way that i've set it up works perfectly for all six sides of a rectangular room, but gets really messy when the gunsight falls on a surface that isn't at 90 degree angles. I would appreciate any help with correcting my code.
Many thanks,