KinematicbodyComponent

Vertical and horizontal movement and collision control for top-down gameplay with RectTiles. Gravity does not affect acceleration and deceleration. Used if the tile map is RectTile.

# Properties

[{"index":"Vector2 Acceleration (Deprecated)","0":"This property is deprecated. Use the SpeedFactor property."}]

[{"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":"boolean EnableJump (Sync)","0":"Shows whether you will use the jump feature."}]

[{"index":"boolean EnableShadow (Sync)","0":"Shows whether you will use the shadow."}]

[{"index":"boolean EnableTileCollision (Sync)","0":"Sets whether to use the collision feature with RectTileMap. There will be no collisions with collision tiles, and RectTileCollisionBeginEvent and RectTileCollisionEndEvent will not be triggered if the value is false."}]

[{"index":"float JumpDrag (Sync)","0":"Jump speed reduction. The greater the value, the faster the fall."}]

[{"index":"float JumpSpeed (Sync)","0":"The jump speed. The greater the value, the faster the jump."}]

[{"index":"Vector2 MoveVelocity (HideFromInspector)","0":"Sets the movement speed. The value multiplied by SpeedFactor will be the final speed.If a player moves a directional key or calls MovementComponent:MoveToDirection() function, MoveVelocity's value will change."}]

[{"index":"Color ShadowColor (Sync)","0":"The shadow's color."}]

[{"index":"Vector2 ShadowOffset (Sync)","0":"The shadow's position."}]

[{"index":"float ShadowScalingRatio (Sync)","0":"The rate of change of the shadow's size. The size varies depending on how high the Entity jumps."}]

[{"index":"Vector2 ShadowSize (Sync)","0":"The shadow's size."}]

[{"index":"Vector2 SpeedFactor (Sync)","0":"When moving, this value is multiplied to the speed traveled in the X or Y direction. The greater the value, the faster the movement."}]

##### 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":"Vector2 GetGroundPosition()","0":"Returns position of the floor based on local coordinates."}]

[{"index":"Vector2 GetWorldGroundPosition()","0":"Returns position of the floor based on World coordinates."}]

[{"index":"boolean IsOnGround()","0":"Checks the current contact with the ground. Returns false when jumping."}]

[{"index":"void OnEnterRectTile(RectTileEnterEvent enterEvent) (ScriptOverridable)","0":"This function is called when RectTileEnterEvent occurs."}]

[{"index":"void OnLeaveRectTile(RectTileLeaveEvent leaveEvent) (ScriptOverridable)","0":"This function is called when RectTileLeaveEvent is generated."}]

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

[{"index":"void SetWorldPosition(Vector2 position)","0":"Sets 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":"KinematicbodyJumpEvent","0":"This event occurs when changing the jumping state."}]

[{"index":"RectTileCollisionBeginEvent","0":"This event occurs when touching the collidable tile."}]

[{"index":"RectTileCollisionEndEvent","0":"This event occurs when being freed from the collided tile."}]

[{"index":"RectTileEnterEvent","0":"This event occurs when entering a specific quadrangle tile."}]

[{"index":"RectTileLeaveEvent","0":"This event occurs when leaving a specific quadrangle tile."}]

# Examples

This is an example of leaping over a tile by using jump.
    
    
    @Component
    script PlatformCollisionController extends Component
        @ExecSpace("ClientOnly")
        method void OnUpdate()
        if _UserService.LocalPlayer ~= self.Entity then
        	return
        end
    
        local kinematicbody = self.Entity.KinematicbodyComponent
    
        local isOnGround = kinematicbody:IsOnGround()
        kinematicbody.EnableTileCollision = isOnGround
        end
    end
    

# SeeAlso

  * KinematicbodyJumpEvent
  * UserService
  * [Control Character Movement from RectTileMap](/docs?postId=748)