RigidbodyComponent

Applies MapleStory movements. These will be influenced by gravity and acceleration and deceleration effects.

# Properties

[{"index":"float AirAccelerationX","0":"Calibrates speed in midair. The higher the value, the faster the speed."}]

[{"index":"float AirDecelerationX","0":"Calibrates how quickly x-axis movement speed stops when there is no input while in midair."}]

[{"index":"boolean ApplyClimbableRotation (Sync)","0":"When true, the character on the rotating or slanted ladder will be affected by the shape of the ladder. When false, the character is not affected by the slant or rotation of the ladder."}]

[{"index":"float DownJumpSpeed","0":"Controls the speed of bouncing up when jumping down."}]

[{"index":"boolean EnableKinematicMoveJump","0":"Determines whether you will use the jump feature if KinematicMove is true."}]

[{"index":"float FallSpeedMaxX","0":"Calibrates max x-axis speed limit while in the air."}]

[{"index":"float FallSpeedMaxY","0":"Calibrates max y-axis speed limit while in the air."}]

[{"index":"float Gravity","0":"Gravity value. Related to the drop velocity when moving mid-air. The bigger the input value, the faster the drop velocity is."}]

[{"index":"boolean IgnoreMoveBoundary","0":"It is possible to leave the terrain-created map area if true."}]

[{"index":"boolean IsBlockVerticalLine","0":"Vertical topography is unconditionally blocked if true, unlike basic movement. This is used to make it impossible to pass through topography like walls."}]

[{"index":"boolean IsolatedMove","0":"Does not fall even when reaching the end of the foothold if the value is true. You can leave the foothold with external movements, such as jumps."}]

[{"index":"float JumpBias","0":"Sets the character's hang time when jumping."}]

[{"index":"boolean KinematicMove","0":"If true, movement will change to top-down vertical and horizontal movement."}]

[{"index":"Vector2 KinematicMoveAcceleration","0":"Set the movement speed. Operates if KinematicMove is true."}]

[{"index":"AutomaticLayerOption LayerSettingType (Sync)","0":"Sets the relationship between the RigidbodyComponent and SortingLayer values of foothold, ladder, and rope."}]

[{"index":"float Mass","0":"Sets the mass of the object. The larger the value is, the slower the acceleration and deceleration, and the lower the reactivity to external factors. Must set a value equal to or greater than 0."}]

[{"index":"Vector2 MoveVelocity (HideFromInspector)","0":"The input required for the move. Inputs are mainly controlled by MovementComponent. A positive X indicates right, and a positive Y indicates upward."}]

[{"index":"Vector2 RealMoveVelocity (HideFromInspector)","0":"Indicates the amount shifted just before. It is read-only and is used when movement amount information is required. A valid execution space exists according to the moving subject, and LocalPlayer has the values from the Client and others from the Server."}]

[{"index":"float WalkAcceleration","0":"It indicates the acceleration\/deceleration value when moving the terrain. The bigger the input, the faster it is to reach the maximum speed."}]

[{"index":"float WalkDrag","0":"The force to resist slipping when moving on the terrain. The larger the input, the faster it stops without slipping. The final applied values range from 0.5 to 2 by calculating the map, terrain, and character attributes."}]

[{"index":"float WalkJump","0":"A value for the height of jump. The bigger the value is, the higher the jump."}]

[{"index":"float WalkSlant","0":"A value associated with the capability to climb slopes when moving on the terrain. Can go over steep slopes if the input is large enough. The value is between 0 and 1."}]

[{"index":"float WalkSpeed","0":"Adjusts the maximum movement speed value when moving on the terrain."}]

##### 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":"void AddForce(Vector2 forcePower)","0":"Adds the force applied to Entity. The Entity will have accelerating and decelerating movements in the direction of the force that was added to the existing force."}]

[{"index":"void AttachTo(string entityId, Vector3 offset)","0":"Attaches this Entity to the Entity corresponding to entityId. With this, this Entity doesn't have a physical motion and becomes subordinate to the movement of the attached Entity."}]

[{"index":"void Detach()","0":"Takes off the Entity which was attached to another Entity using RigidbodyComponent:AttachTo(string, Vector3)."}]

[{"index":"boolean DownJump()","0":"Performs jumping down. Jumping down is only valid on terrain."}]

[{"index":"Foothold GetCurrentFoothold()","0":"Returns the Foothold that you are currently stepping on."}]

[{"index":"Vector2 GetCurrentFootholdPerpendicular()","0":"Returns the vertical line of the terrain being treaded on."}]

[{"index":"boolean IsOnGround()","0":"Checks whether standing on the terrain or not."}]

[{"index":"boolean JustJump(Vector2 jumpRate)","0":"Makes a target jump."}]

[{"index":"void PositionReset()","0":"The accumulated information of calculating location is deleted and a new calculation is made based on the current location."}]

[{"index":"boolean PredictFootholdEnd(float distance, boolean isFoward)","0":"Checks whether you can move the distance from the step you are currently stepping on. If isForward is true, checks the right direction, if it is false, checks the left direction.Returns true if the distance from the current position to the end of the foothold is farther than distance, and false if it is closer. Returns false if you are not stepping on a foothold."}]

[{"index":"void SetForce(Vector2 forcePower)","0":"Sets the force applied to the Entity. The Entity will have accelerating and decelerating movements in the direction of the force set."}]

[{"index":"void SetForceReserve(Vector2 forcePower)","0":"Instead of applying the force immediately, it replaces the force with the given input after finishing the move in the current frame."}]

[{"index":"void SetPosition(Vector2 position)","0":"Sets an Entity's position based on local coordinates."}]

[{"index":"void SetUseCustomMove(boolean isUse) (Deprecated)","0":"This function is deprecated. Use the Enable property of RigidbodyComponent."}]

[{"index":"void SetWorldPosition(Vector2 position)","0":"Sets an Entity's location to the world-based coordinates."}]

##### 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."}]

# Events

[{"index":"FootholdCollisionEvent","0":"This event occurs when RigidBodyComponent collides with the foothold."}]

[{"index":"FootholdEnterEvent","0":"This event occurs when the entity is attached to the foothold."}]

[{"index":"FootholdLeaveEvent","0":"This event occurs when the entity comes off of the foothold."}]

[{"index":"RigidbodyAttachEvent","0":"The event occurs when the Entity attaches to another Entity using RigidbodyComponent:AttachTo(string, Vector3). Players occur on the client, other entities occur on the server."}]

[{"index":"RigidbodyClimbableAttachStartEvent","0":"This Event occurs before the Avatar climbs the ladder or rope."}]

[{"index":"RigidbodyClimbableDetachEndEvent","0":"Event that occurs after an Avatar falls from a ladder or rope."}]

[{"index":"RigidbodyDetachEvent","0":"This event is raised when the entity is released from its Attach state via RigidbodyComponent:Detach(). Players occur on the client and other entities occur in server space."}]

[{"index":"RigidbodyKinematicMoveJumpEvent","0":"This event occurs when jumping or landing while the KinematicMove property is true."}]

# Examples

#### AttachTo

Attaches when touching a specific object, and detaches after 3 seconds of being attached.
    
    
    @Component
    script TimedAttacher extends Component
        @Sync
        property number time = 0
        @Sync
        property boolean isAttached = false
    
        @ExecSpace("ClientOnly")
        method void AttachTo(string entityId)
        self.Entity.RigidbodyComponent:AttachTo(entityId, Vector3.zero)
        self.isAttached = true
        end
    
        @ExecSpace("ClientOnly")
        method void OnUpdate(number delta)
        if self.isAttached == false then
        	return
        end
    
        self.time = self.time + delta
    
        if self.time >= 3.0 then
        	self.Entity.RigidbodyComponent:Detach()
        	self.time = 0
        	self.isAttached = false
        end
        end
    
        @EventSender("Self")
        handler HandleTriggerEnterEvent(TriggerEnterEvent event)
        --------------- Native Event Sender Info ----------------
        -- Sender: TriggerComponent
        -- Space: Server, Client
        ---------------------------------------------------------
    
        -- Parameters
        local TriggerBodyEntity = event.TriggerBodyEntity
        ---------------------------------------------------------
        if TriggerBodyEntity.Name == "Name" then
        	self:AttachTo(TriggerBodyEntity.Id)
        end
        end
    end
    

#### PredictFootholdEnd

Determines whether the end point of the foothold is separated by a specific distance. Returns true if the end of the foothold is closer than 10 in the positive direction from the foothold the character is stepping on, and false otherwise. The Enable state of the Entity is then changed depending on the results.
    
    
    @Component
    script FootholdActivator extends Component
        @ExecSpace("ClientOnly")
        method void OnUpdate(number delta)
        local entity = _EntityService:GetEntityByPath(EntityPath)
        if self.Entity.RigidbodyComponent:PredictFootholdEnd(10, true) then
        	entity.Enable = true
        else
        	entity.Enable = false
        end
        end
    end
    

# SeeAlso

  * TriggerComponent
  * TriggerEnterEvent
  * [Understanding MapleStory Movement Concepts](/docs?postId=750)