Hi
In your code you use raycast inside of an object, wich could lead to problems.
however, you still don't save directions in xx# etc.
Here your example as bullet hole tracing (and sorry for my bad english):
set display mode 800,600,32,1
autocam off
hide mouse
position camera 0,10,-20 : point camera 0,4,0
phy start
make object box 1,90,0.1,90
make object sphere 2,3 : position object 2,0,10,0
make object cube 3,3 : position object 3,0,10,14
make object plane 4,1,1
color object 4,rgb(255,0,0)
phy make rigid body static box 1
phy make rigid body dynamic sphere 2
phy make rigid body dynamic box 3
do
x#=camera position x()
y#=camera position y()
z#=camera position z()
inc AngX#,mousemovex()*0.2
inc AngY#,mousemovey()*0.2
CamAngX#=curvevalue(AngX#,CamAngX#,7)
CamAngY#=curvevalue(AngY#,CamAngY#,7)
control camera using arrowkeys 0,2,2
rotate camera CamAngY#,CamAngX#,0
xx#=camera position x()
yy#=camera position y()
zz#=camera position z()
move camera 1
xx#=camera position x()-xx#
yy#=camera position y()-yy#
zz#=camera position z()-zz#
move camera -1
me#=phy ray cast closest shape(x#,y#,z#,xx#,yy#,zz#)
hey=phy get ray cast hit()
ObjectX#=phy get ray cast hit point x()
ObjectY#=phy get ray cast hit point y()
ObjectZ#=phy get ray cast hit point z()
NormX#=phy get ray cast hit normal x()
NormY#=phy get ray cast hit normal y()
NormZ#=phy get ray cast hit normal z()
position object 4,ObjectX#,ObjectY#,ObjectZ#
point object 4,ObjectX#+NormX#,ObjectY#+NormY#,ObjectZ#+NormZ#
move object 4,0.01
text 10,10,str$(hey)
phy update
loop