This should get you closer. I had to fill in some blanks and make some assumptions.
sync on
sync rate 60
hide mouse
make memblock 1, 16
Make Object Sphere 999,200
Position Object 999,0,0,1000
Color Object 999,RGB(200,0,0)
SC_SetupObject 999,1,1
Make Object Plain 20,30,30
Color Object 20,RGB(0,255,0)
hide object 20
Make Object Plain 308, 1, 1
Hide Object 308
do
rotate camera 0, camera angle x(0) + (mousemovey() / 2.0), camera angle y(0) + (mousemovex() / 2.0), 0.0
if mouseclick() then gosub PlayerShooting
sync
loop
PlayerShooting:
`OldX# = Limb Position X(PlrObj,PlayerFirespot)
`OldY# = Limb Position Y(PlrObj,PlayerFirespot)
`OldZ# = Limb Position Z(PlrObj,PlayerFirespot)
OldX# = Camera Position X(0)
OldY# = Camera Position Y(0)
OldZ# = Camera Position Z(0)
Position Object 308, Camera Position X(0), Camera Position Y(0), Camera Position Z(0)
Rotate Object 308, Camera Angle X(0), Camera Angle Y(0), Camera Angle Z(0)
Move Object 308, 2000
X# = Object Position X(308)
Y# = Object Position Y(308)
Z# = Object Position Z(308)
BulletCollision = SC_RayCast(0,OldX#,OldY#,OldZ#,X#,Y#,Z#,0)
If BulletCollision > 0
NewX# = SC_GetStaticCollisionX()
NewY# = SC_GetStaticCollisionY()
NewZ# = SC_GetStaticCollisionZ()
NormX# = SC_GetCollisionNormalX()
NormY# = SC_GetCollisionNormalY()
NormZ# = SC_GetCollisionNormalZ()
Position Object 20,NewX#+NormX#/10,NewY#+NormY#/10,NewZ#+NormZ#/10
Point Object 20,NewX#+NormX#,NewY#+NormY#,NewZ#+NormZ#
Show Object 20
Else
Hide Object 20
Endif
return
Try this and let us know how it works for you, or if you need anything else.
- Jane