How to make a ball able to go anywhere on my "field"??
So i have a player, and i have a ball. I have the player able to run up to the ball and "pick it up" (aka parent the ball to the player, until the A button is pressed, then it unparents). The problem is, after the player picks up the ball and runs around with it. Once the ball reaches roughly halfway on the "field" (which is a cube that is stretched out), it wont go past halfway..its like there's an invisible wall that does not allow the ball to continue going any further..any ideas?
This is my current player movement script:
function Movement() { // This line is for vertical movement, right now its on the Z AXIS. transform.Translate(0,0,Input.GetAxis("Vertical") Time.deltaTime PlayerMovementSpeed);
// This line is for horizontal movement, right now its on the X AXIS. When combined with vertical movement it can be used for Strafing.
transform.Translate(Input.GetAxis("Horizontal") * Time.deltaTime * PlayerMovementSpeed,0,0);
// This line is for rotation, right now its on the Y AXIS.
transform.Rotate(0,Input.GetAxis("RightStick") * Time.deltaTime * PlayerRotationSpeed,0);
This is my collision for the ball:
function Update(hit : Collision) {
if (hit.gameObject.tag == "Player"){
GetComponent.<Rigidbody>().isKinematic = true;
GetComponent.<Collider>().isTrigger = true;
}
}
This is my current player collision:
function OnCollisionEnter(collision : Collision){
if(collision.gameObject.tag == "Ball"){
var xys = collision.gameObject.transform;
xys.parent = transform;
}
}
Based on what you posted here, there is no reason for it to not pass. It's probably something else you haven't shown. How do you keep the player within bounds? Post that script as well, and if you use colliders to do that, include a pic of their positions and the player/ball colliders next to it
Your answer
![](https://koobas.hobune.stream/wayback/20220612091424im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rigidbody local position constraints 2 Answers
Falling Platform 1 Answer
Rotating around a point using Rigidbody? 0 Answers