Carry Item


Update:

Character can carry and drop item.

How to carry item:

1: Go near Item

2: Hold E to Take Item

When character is carrying items -> speed's character will reduce and no longer can run.

How it work:

When player click E to carry items:

1: Disable all Component in Items.

2; Attach Item to Character and set position and rotation of item to zero

3: Calculate mesh size => position and rotation of "CarryPos" (Game Object in Character)

  "LimitPos" - (Game Object in Character) to set min a distance between item and Character


   Item is square => "CarryPos": X=0 ,   Y = LimitPos.Y,   Z= LimitPos.Z +(meshSize.Z/2)

  Item is rectangle =>

     MeshSize X is Longest: => "CarryPos" 

    => X = 0,   

    Y= LimitPos.Y + (MeshSize.Y/2),  

    Z= LimitPos.Z +( MeshSize.Z/2)


    MeshSize Y is Longest: => RotateZ = 90 and "CarryPos" 

    => X =  MeshSize.Y/2

    Y= LimitPos.Y + (MeshSize.X/2), 

    Z= LimitPos.Z +(MeshSize.Z/2)


    MeshSize Z is Longest: => RotateY = 90 and "CarryPos" 

    => X = 0, 

    Y= LimitPos.Y 

    Z= LimitPos.Z +( MeshSize.X/2)

4: Attach Item to CarryPos and use tween to Move and Rotate CarryPos to new calculated Position upthere

Maybe this solution suck but this is the way! ^

Leave a comment

Log in with itch.io to leave a comment.