RevoluteJointComponent

Create and delete RevoluteJoint. Controls the relative rotation of connected rigid bodies.

# Properties

[{"index":"SyncList Joints (Sync) (ReadOnly)","0":"Set Joint information."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"int32 AddJoint(Entity targetEntity, Vector2 localAnchorA, Vector2 localAnchorB)","0":"Add Joint. Return index on success, -1 on failure"}]

[{"index":"void DestroyJoint(int32 index)","0":"Removes the Joint whose sequence number corresponds to the index."}]

[{"index":"int32 GetJointsCount()","0":"Returns the number of joints."}]

[{"index":"void SetCollideConnected(int32 index, boolean collideConnected)","0":"Set the CollideConnected value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetLocalAnchorA(int32 index, Vector2 localAnchorA)","0":"Set the LocalAnchorA value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetLocalAnchorB(int32 index, Vector2 localAnchorB)","0":"Set the LocalAnchorB value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetLowerAngle(int32 index, float lowerAngle)","0":"Set the LowerAngle value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetMaxMotorTorque(int32 index, float maxMotorTorque)","0":"Sets the MaxMotorTorque value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetMotorEnable(int32 index, boolean enable)","0":"Set the MotorEnable value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetMotorSpeed(int32 index, float speed)","0":"Set the MotorSpeed value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetUpperAngle(int32 index, float upperAngle)","0":"Set the UpperAngle value of the Joint whose sequence number corresponds to index."}]

[{"index":"void SetUseLimits(int32 index, boolean useLimits)","0":"Set the UseLimits value of the Joint whose sequence number corresponds to index."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Examples

#### SetMotorSpeed

In this example, tap the W or S keys on the keyboard to rotate the Entity set as TargetEntityRef.
    
    
    @Component
    script DirectionalJointController extends Component
        @ExecSpace("ServerOnly")
        method void GoUp()
        self.Entity.RevoluteJointComponent:SetMotorSpeed(1, 10)
        end
    
        @ExecSpace("ServerOnly")
        method void GoDown()
        self.Entity.RevoluteJointComponent:SetMotorSpeed(1, -10)
        end
    
        @ExecSpace("ServerOnly")
        method void Stop()
        self.Entity.RevoluteJointComponent:SetMotorSpeed(1, 0)
        end
    
        @EventSender("Service", "InputService")
        handler HandleKeyDownEvent(KeyDownEvent event)
        --------------- Native Event Sender Info ----------------
        -- Sender: InputService
        -- Space: Client
        ---------------------------------------------------------
    
        -- Parameters
        local key = event.key
        ---------------------------------------------------------
        if key == KeyboardKey.W then
        	self:GoUp()
        elseif key == KeyboardKey.S then
        	self:GoDown()
        end
        end
    
        @EventSender("Service", "InputService")
        handler HandleKeyUpEvent(KeyUpEvent event)
        --------------- Native Event Sender Info ----------------
        -- Sender: InputService
        -- Space: Client
        ---------------------------------------------------------
    
        -- Parameters
        local key = event.key
        ---------------------------------------------------------
        self:Stop()
        end
    end
    

# SeeAlso

  * KeyboardKey
  * KeyDownEvent
  * KeyUpEvent
  * InputService
  * [Applying Physics to Entities ](/docs?postId=761)
  * [Using Physics](/docs?postId=757)
  * [Using Various Physics Joints](/docs?postId=760)