ArcBasicDocs
3DPhysicsArcBasic extension

EntitySpinPitch

Pitch turning speed of a physics body, in degrees a second.

EntitySpinPitch# ( entity )

Parameters

entity
entity handle

Description

Returns how fast a physics body is turning in pitch, in degrees a second. Entities without a body return 0. Turning speeds are in degrees a second and follow the same directions as TurnEntity: positive pitch tips the front down, positive yaw turns left and positive roll tilts left.

Example

EntitySpinPitch.absOpen in editor
; Physics forces example (an ArcBasic extension); Arrows push the ball, Space makes it jump, T gives it a twistGraphics3D 640,480SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,10,-14TurnEntity camera,35,0,0light=CreateLight()RotateEntity light,50,30,0ground=CreatePlane()EntityColor ground,90,90,130EntityPhysics ground,1ball=CreateSphere(16)PositionEntity ball,0,1,0EntityColor ball,255,200,60EntityPhysics ball,2,1box=CreateCube()PositionEntity box,4,1,2EntityPhysics box,2,2While Not KeyHit(1)	; forces push steadily while the keys are held	If KeyDown(203) Then ApplyForce ball,-15,0,0	If KeyDown(205) Then ApplyForce ball,15,0,0	If KeyDown(200) Then ApplyForce ball,0,0,15	If KeyDown(208) Then ApplyForce ball,0,0,-15	; impulses act at once	If KeyHit(57) And EntityY(ball)<1.1 Then ApplyImpulse ball,0,6,0	If KeyHit(20) Then ApplyTorqueImpulse box,0,8,0 : ApplyImpulse box,0,10,0	If KeyHit(31) Then SetEntityVelocity ball,0,0,0 : SetEntitySpin ball,0,0,0	If KeyDown(25) Then ApplyTorque box,0,0,20	UpdateWorld	RenderWorld	Text 0,0,"Arrows: push   Space: jump   T: flip the box   P: roll the box   S: stop the ball"	speed#=Sqr(EntityVelocityX(ball)^2+EntityVelocityY(ball)^2+EntityVelocityZ(ball)^2)	Text 0,15,"Ball speed: "+speed+" units a second"	Text 0,30,"Box spin: "+EntitySpinPitch(box)+", "+EntitySpinYaw(box)+", "+EntitySpinRoll(box)	FlipWendEnd

See also