#Rigidbody

1 messages · Page 1 of 1 (latest)

waxen beacon
#

Lets talk in here, so there isnt 2 convos in here @rain dust

rain dust
#

Sure thing

waxen beacon
#

Check IsKinematic

#

oh its 2d, set body type to kinemaitc

rain dust
#

This is the issue I'm facing.

#

@waxen beacon

waxen beacon
#

Turn off the freeze position while kinematic

#

and how do you move the character, set position or Rigidbody move to?

rain dust
#

That option isn't available in Kinematic mode.

rain dust
#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    // Private variables.
    private Rigidbody2D rigidBody2D;

    [Header("Movement Properties")]
    public float speed = 500f;

    // Start is called before the first frame update.
    void Start()
    {
        
        // Set private components part of the game object.
        rigidBody2D = GetComponent<Rigidbody2D>();

    }

    // Update is called once per frame.
    void Update()
    {

        // Collect movement axis from `Input`.
        float horizontal = Input.GetAxisRaw("Horizontal"); // Add smoothing.
        float vertical = Input.GetAxisRaw("Vertical");

        // Create a `Vector2` for velocity and normalize it.
        Vector2 direction = new Vector2(horizontal, vertical);
        direction = direction.normalized;

        // Apply the `Vector2` to the `Rigidbody` velocity.
        rigidBody2D.velocity = direction * speed * Time.deltaTime;

    }
}
waxen beacon
#

Huh, in the video its checked and not greyed out

rain dust
waxen beacon
#

can you show me a screenshot of the player gameobject?

rain dust
waxen beacon
#

ill quickly setup a playground to emulate your stuff

#

can you send me your playerscript? if i type that up myself its gonna take a minute longer 😄

rain dust
#

Sure thing, it should be above.

waxen beacon
#

oh lol im dumb 😄

rain dust
#

Nahh, you're good

waxen beacon
#

alright, ill ping you when im done

quasi parcel
#

Does your grid have a rigid body on it

waxen beacon
#

Oh wait right, why does it even have that, why didnt I think about that lol

#

@rain dust ^ lemons question could solve that

#

your walls dont need the rigidbody

rain dust
quasi parcel
#

Yeah but the grid object itself shouldn’t have one

#

Just the tile maps themselves

waxen beacon
#

Btw, can you use a tilemap collider?

#

Im sadly not too familiar with tilemaps

rain dust
rain dust
quasi parcel
#

Ok they it’s your player?

#

Because rewatching it, the player is moving not the tile maps

#

Take the camera off the player

#

See which one moves

rain dust
#

The player's positon is stationary and it's position isn't modified outside of the code attached above via rigidBody.velocity

waxen beacon
#

I have now replicated your project, ill ping you if i find a solution

quasi parcel
#

this is what mine looks like

rain dust
#

It appears yours and mine are the same, unless I'm missing something.
I'm starting to wonder if two kinematic objects can even collide with eachother.

quasi parcel
#

lol im confused as to how you could do this without it being dynamic

rain dust
#

My rigid body on the player is Kinematic and I self program the movements since I don't want physics applied.

quasi parcel
#

well maybe thats your problem

#

your player should be dynamic

waxen beacon
quasi parcel
#

yeah

#

although im still confused if your map is falling independent of the player

waxen beacon
#

with player on dynamic with 0 gravity

rain dust
quasi parcel
#

I mean you can use unity for collisions, or you can program your own

#

but I feel like you might be missing something if you're not trying to program your own physics

rain dust
#

Yeah, not sure I'm at that stage yet.
I'll stick to Dynamic.

I appreciate the help you two!

waxen beacon
#

No problem! Glad we could help

quasi parcel
#

if you need help with the player let me know

rain dust