It looks like the first parameter of the 'phy get collision normal force' command should be the ball object number and the second parameter needs to be zero. Here's an example I put together...
global camera_pitch as float: global camera_yaw as float
global x_force as float: global y_force as float: global z_force as float
#Constant COLLISION_THRESHOLD 400000000
#Constant GROUND_OBJECT_NUMBER 1: #Constant SPHERE_OBJECT_NUMBER 2
#Constant IMPACT_SOUND 1
#Constant A_KEY 30: #Constant S_KEY 31: #Constant Q_KEY 16: #Constant Z_KEY 44
#Constant FALSE 0: #Constant TRUE 1
Rem -------------------------------------------------------
Start_Physics()
Set_Display_Mode()
Set_Lighting_Parameters()
Set_Default_Camera_Location()
Create_Objects()
Load_Sounds()
Rem =======================================================
repeat
Tilt_Ground_Object()
if Check_For_Object_Collision(SPHERE_OBJECT_NUMBER) = TRUE then play sound IMPACT_SOUND
Set_Camera_Location()
phy update
sync
until escapekey()
end
Rem =======================================================
function Start_Physics()
phy start
phy set gravity 0, -100, 0
endfunction
Rem -------------------------------------------------------
function Set_Display_Mode()
set display mode desktop width(), desktop height(), 16
sync on: sync rate 60
color backdrop rgb(64, 64, 64)
hide mouse
endfunction
Rem -------------------------------------------------------
function Set_Lighting_Parameters()
set ambient light 10
make light 1
set spot light 1, 60, 90
position light 1, 200, 200, 200
point light 1, 0, 0, 0
endfunction
Rem -------------------------------------------------------
function Set_Default_Camera_Location()
autocam off
position camera 0, 50, 220
camera_pitch = 350
camera_yaw = 180
endfunction
Rem -------------------------------------------------------
function Set_Camera_Location()
camera_yaw = wrapvalue(camera_yaw + mousemovex() / 2)
camera_pitch = wrapvalue(camera_pitch + mousemovey() / -2)
rotate camera 0, camera_yaw, 0
pitch camera up camera_pitch
if upkey() then move camera 2
if downkey() then move camera -2
text 0, screen height() - 90, "Camera X = " + str$(camera position x())
text 0, screen height() - 75, "Camera Y = " + str$(camera position y())
text 0, screen height() - 60, "Camera Z = " + str$(camera position z())
text 0, screen height() - 30, "Camera Pitch = " + str$(camera_pitch)
text 0, screen height() - 15, "Camera Yaw = " + str$(camera_yaw)
endfunction
Rem -------------------------------------------------------
function Tilt_Ground_Object()
local x_angle as float: local z_angle as float
x_angle = object angle x(GROUND_OBJECT_NUMBER)
z_angle = object angle z(GROUND_OBJECT_NUMBER)
if scancode() = A_KEY then phy set rigid body rotation GROUND_OBJECT_NUMBER, x_angle, 0, z_angle - .3
if scancode() = S_KEY then phy set rigid body rotation GROUND_OBJECT_NUMBER, x_angle, 0, z_angle + .3
if scancode() = Q_KEY then phy set rigid body rotation GROUND_OBJECT_NUMBER, x_angle - .3, 0, z_angle
if scancode() = Z_KEY then phy set rigid body rotation GROUND_OBJECT_NUMBER, x_angle + .3, 0, z_angle
endfunction
Rem -------------------------------------------------------
function Check_For_Object_Collision(object_number as integer)
rem local x_force as float: local y_force as float: local z_force as float
local object_a as integer: local object_b as integer
local collision_result
while phy get collision data()
object_a = phy get collision object a()
object_b = phy get collision object b()
if object_a = object_number or object_b = object_number
x_force = abs(phy get collision normal force x(SPHERE_OBJECT_NUMBER, 0))
y_force = abs(phy get collision normal force y(SPHERE_OBJECT_NUMBER, 0))
z_force = abs(phy get collision normal force z(SPHERE_OBJECT_NUMBER, 0))
if x_force > COLLISION_THRESHOLD or y_force > COLLISION_THRESHOLD or z_force > COLLISION_THRESHOLD then collision_result = TRUE
endif
endwhile
text screen width() / 2, 0, "X Force = " + str$(x_force)
text screen width() / 2, 15, "Y Force = " + str$(y_force)
text screen width() / 2, 30, "Z Force = " + str$(z_force)
endfunction collision_result
Rem -------------------------------------------------------
function Create_Objects()
Rem - make a ground object
make object box GROUND_OBJECT_NUMBER, 300, 1, 300
color object GROUND_OBJECT_NUMBER, rgb(0, 92, 0)
phy make rigid body static box GROUND_OBJECT_NUMBER
make object sphere SPHERE_OBJECT_NUMBER, 30
position object SPHERE_OBJECT_NUMBER, 0, 100, 0
color object SPHERE_OBJECT_NUMBER, rgb(0, 0, 192)
phy make rigid body dynamic sphere SPHERE_OBJECT_NUMBER
endfunction
Rem -------------------------------------------------------
function Load_Sounds()
load sound "C:\Temp\Beep.wav", IMPACT_SOUND
endfunction
Rem -------------------------------------------------------
I've made the x_force, y_force & z_force variables global so you can see their values. You'll need to adjust the 'COLLISION_THRESHOLD' constant depending on the global gravity, object mass and it's maximum velocity.
Looking for the vortex to another Earth