module Box3D.PrismaticJoint
( create
, enableSpring
, isSpringEnabled
, setSpringHertz
, getSpringHertz
, setSpringDampingRatio
, getSpringDampingRatio
, setTargetTranslation
, getTargetTranslation
, enableLimit
, isLimitEnabled
, getLowerLimit
, getUpperLimit
, setLimits
, enableMotor
, isMotorEnabled
, setMotorSpeed
, getMotorSpeed
, setMaxMotorForce
, getMaxMotorForce
, getMotorForce
, getTranslation
, getSpeed
)
where
import Foreign
import Foreign.C.Types (CBool(..))
import Box3D.Id (JointId(..), WorldId(..))
import Box3D.Types (PrismaticJointDef)
foreign import ccall unsafe "b3CreatePrismaticJoint"
c_b3CreatePrismaticJoint :: WorldId -> Ptr PrismaticJointDef -> IO JointId
foreign import ccall unsafe "b3PrismaticJoint_EnableSpring"
c_b3PrismaticJoint_EnableSpring :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_IsSpringEnabled"
c_b3PrismaticJoint_IsSpringEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b3PrismaticJoint_SetSpringHertz"
c_b3PrismaticJoint_SetSpringHertz :: JointId -> Float -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_GetSpringHertz"
c_b3PrismaticJoint_GetSpringHertz :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_SetSpringDampingRatio"
c_b3PrismaticJoint_SetSpringDampingRatio :: JointId -> Float -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_GetSpringDampingRatio"
c_b3PrismaticJoint_GetSpringDampingRatio :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_SetTargetTranslation"
c_b3PrismaticJoint_SetTargetTranslation :: JointId -> Float -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_GetTargetTranslation"
c_b3PrismaticJoint_GetTargetTranslation :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_EnableLimit"
c_b3PrismaticJoint_EnableLimit :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_IsLimitEnabled"
c_b3PrismaticJoint_IsLimitEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b3PrismaticJoint_GetLowerLimit"
c_b3PrismaticJoint_GetLowerLimit :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_GetUpperLimit"
c_b3PrismaticJoint_GetUpperLimit :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_SetLimits"
c_b3PrismaticJoint_SetLimits :: JointId -> Float -> Float -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_EnableMotor"
c_b3PrismaticJoint_EnableMotor :: JointId -> CBool -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_IsMotorEnabled"
c_b3PrismaticJoint_IsMotorEnabled :: JointId -> IO CBool
foreign import ccall unsafe "b3PrismaticJoint_SetMotorSpeed"
c_b3PrismaticJoint_SetMotorSpeed :: JointId -> Float -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_GetMotorSpeed"
c_b3PrismaticJoint_GetMotorSpeed :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_SetMaxMotorForce"
c_b3PrismaticJoint_SetMaxMotorForce :: JointId -> Float -> IO ()
foreign import ccall unsafe "b3PrismaticJoint_GetMaxMotorForce"
c_b3PrismaticJoint_GetMaxMotorForce :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_GetMotorForce"
c_b3PrismaticJoint_GetMotorForce :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_GetTranslation"
c_b3PrismaticJoint_GetTranslation :: JointId -> IO Float
foreign import ccall unsafe "b3PrismaticJoint_GetSpeed"
c_b3PrismaticJoint_GetSpeed :: JointId -> IO Float
create
:: WorldId
-> PrismaticJointDef
-> IO JointId
create :: WorldId -> PrismaticJointDef -> IO JointId
create WorldId
a0 PrismaticJointDef
a1 =
PrismaticJointDef
-> (Ptr PrismaticJointDef -> IO JointId) -> IO JointId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with PrismaticJointDef
a1 ((Ptr PrismaticJointDef -> IO JointId) -> IO JointId)
-> (Ptr PrismaticJointDef -> IO JointId) -> IO JointId
forall a b. (a -> b) -> a -> b
$ \Ptr PrismaticJointDef
p1 ->
WorldId -> Ptr PrismaticJointDef -> IO JointId
c_b3CreatePrismaticJoint WorldId
a0 Ptr PrismaticJointDef
p1
enableSpring
:: JointId
-> Bool
-> IO ()
enableSpring :: JointId -> Bool -> IO ()
enableSpring JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b3PrismaticJoint_EnableSpring JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isSpringEnabled
:: JointId
-> IO Bool
isSpringEnabled :: JointId -> IO Bool
isSpringEnabled JointId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (JointId -> IO CBool
c_b3PrismaticJoint_IsSpringEnabled JointId
a0)
setSpringHertz
:: JointId
-> Float
-> IO ()
setSpringHertz :: JointId -> Float -> IO ()
setSpringHertz JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b3PrismaticJoint_SetSpringHertz JointId
a0 Float
a1
getSpringHertz
:: JointId
-> IO Float
getSpringHertz :: JointId -> IO Float
getSpringHertz JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetSpringHertz JointId
a0
setSpringDampingRatio
:: JointId
-> Float
-> IO ()
setSpringDampingRatio :: JointId -> Float -> IO ()
setSpringDampingRatio JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b3PrismaticJoint_SetSpringDampingRatio JointId
a0 Float
a1
getSpringDampingRatio
:: JointId
-> IO Float
getSpringDampingRatio :: JointId -> IO Float
getSpringDampingRatio JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetSpringDampingRatio JointId
a0
setTargetTranslation
:: JointId
-> Float
-> IO ()
setTargetTranslation :: JointId -> Float -> IO ()
setTargetTranslation JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b3PrismaticJoint_SetTargetTranslation JointId
a0 Float
a1
getTargetTranslation
:: JointId
-> IO Float
getTargetTranslation :: JointId -> IO Float
getTargetTranslation JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetTargetTranslation JointId
a0
enableLimit
:: JointId
-> Bool
-> IO ()
enableLimit :: JointId -> Bool -> IO ()
enableLimit JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b3PrismaticJoint_EnableLimit JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isLimitEnabled
:: JointId
-> IO Bool
isLimitEnabled :: JointId -> IO Bool
isLimitEnabled JointId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (JointId -> IO CBool
c_b3PrismaticJoint_IsLimitEnabled JointId
a0)
getLowerLimit
:: JointId
-> IO Float
getLowerLimit :: JointId -> IO Float
getLowerLimit JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetLowerLimit JointId
a0
getUpperLimit
:: JointId
-> IO Float
getUpperLimit :: JointId -> IO Float
getUpperLimit JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetUpperLimit JointId
a0
setLimits
:: JointId
-> Float
-> Float
-> IO ()
setLimits :: JointId -> Float -> Float -> IO ()
setLimits JointId
a0 Float
a1 Float
a2 =
JointId -> Float -> Float -> IO ()
c_b3PrismaticJoint_SetLimits JointId
a0 Float
a1 Float
a2
enableMotor
:: JointId
-> Bool
-> IO ()
enableMotor :: JointId -> Bool -> IO ()
enableMotor JointId
a0 Bool
a1 =
JointId -> CBool -> IO ()
c_b3PrismaticJoint_EnableMotor JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)
isMotorEnabled
:: JointId
-> IO Bool
isMotorEnabled :: JointId -> IO Bool
isMotorEnabled JointId
a0 =
CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (JointId -> IO CBool
c_b3PrismaticJoint_IsMotorEnabled JointId
a0)
setMotorSpeed
:: JointId
-> Float
-> IO ()
setMotorSpeed :: JointId -> Float -> IO ()
setMotorSpeed JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b3PrismaticJoint_SetMotorSpeed JointId
a0 Float
a1
getMotorSpeed
:: JointId
-> IO Float
getMotorSpeed :: JointId -> IO Float
getMotorSpeed JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetMotorSpeed JointId
a0
setMaxMotorForce
:: JointId
-> Float
-> IO ()
setMaxMotorForce :: JointId -> Float -> IO ()
setMaxMotorForce JointId
a0 Float
a1 =
JointId -> Float -> IO ()
c_b3PrismaticJoint_SetMaxMotorForce JointId
a0 Float
a1
getMaxMotorForce
:: JointId
-> IO Float
getMaxMotorForce :: JointId -> IO Float
getMaxMotorForce JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetMaxMotorForce JointId
a0
getMotorForce
:: JointId
-> IO Float
getMotorForce :: JointId -> IO Float
getMotorForce JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetMotorForce JointId
a0
getTranslation
:: JointId
-> IO Float
getTranslation :: JointId -> IO Float
getTranslation JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetTranslation JointId
a0
getSpeed
:: JointId
-> IO Float
getSpeed :: JointId -> IO Float
getSpeed JointId
a0 =
JointId -> IO Float
c_b3PrismaticJoint_GetSpeed JointId
a0