Hello. I am new to unity trying to get to grips with the physics.
The Issue I am having is as follows :
I am using unity in 3D, not 2D.
I have a cube object, that is supposed to be a platform,and is marked as kinematic, and is being moved along the z axis with a script, using transform.Translate. my script works fine (its very basic), however, when I ‘Drop’ an object onto it, the object slides from underneath it, rather than moving with the platform. I have tried adding a physical material to both the object and the platform, and played with the drag settings. Is there something that I have missed?
I also know I could move the platform with addforce, but that would cause other problems, or is this the only way to achieve what I am doing?
Script I am using for moving the platform:
Regards
Dave
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PusherMotion : MonoBehaviour {
public float speed = 1f;
public float forwardlimit = 3.45f;
public float backwardlimit = 6.25f;
public bool backwardmotion = true;
void Start () {
}
void Update () {
if (backwardmotion) {
transform.Translate (0, 0, speed * Time.deltaTime);
} else {
transform.Translate (0, 0, -speed * Time.deltaTime);
}
if (transform.position.z >= backwardlimit ) {
backwardmotion = false;
}
if (transform.position.z <= forwardlimit ) {
backwardmotion = true;
}
}
}