Go Back   Physics Help Forum > Physics Forums > Physics

Physics Physics Forum - General Physics Discussion and Physics News

LinkBack Thread Tools Display Modes
Old Jan 2nd 2018, 01:42 AM   #1
Junior Member
Join Date: Nov 2016
Posts: 4
AddForce issue after rotation of the object axis

Hi, I'm new to unity, and I am trying to create a simple game where a cube moves and jump around a field.
I encountered a problem, sometimes, when the cube jumps and moves he flips and he falls facing the ground with another face than the starting one, this creates a problem when I use the AddForce to move.
I tried to use a Father Gameobject, but, since the father can't have a collider I can't use the method AddForce (I must use transform.translate) and every time the cube hits a wall the collision is not precise and it gets stuck to the wall for a moment.

Can someone help me?

I hope I explained it well, 'cause I find it hard to explain.

here's the code I use to move the father:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveComponent : MonoBehaviour {

private float moveHorizontal;
private float moveVertical;

public Rigidbody rb;

public float speed;

void Start()
rb = GetComponent<Rigidbody> ();

void Update ()
moveHorizontal = Input.GetAxis ("Horizontal")*Time.deltaTime;
moveVertical = Input.GetAxis ("Vertical")*Time.deltaTime;

Vector3 movement = new Vector3 (moveHorizontal, 0, moveVertical);

transform.Translate (movement * speed);

adamjackson is offline   Reply With Quote

  Physics Help Forum > Physics Forums > Physics

addforce, axis, issue, object, rotation

Thread Tools
Display Modes

Similar Physics Forum Discussions
Thread Thread Starter Forum Replies Last Post
rotation about fixed axis ling233 Kinematics and Dynamics 5 Dec 18th 2015 02:05 PM
Stability Issue Help Alexis87 Equilibrium and Elasticity 3 Oct 30th 2013 02:54 PM
Pendulum and Pin issue MickMartin Energy and Work 4 Nov 16th 2012 11:59 AM
Issue with design speed xtheunknown0 Kinematics and Dynamics 7 Jan 21st 2011 04:35 AM
Rotation about Fixed Axis Ruler of Hell Kinematics and Dynamics 0 May 26th 2010 04:03 AM

Facebook Twitter Google+ RSS Feed