• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Tom-Featherhill · Sep 29, 2014 at 02:12 PM · physicsmeshmodelmesh colliders

Player falls through Curved Mesh Colliders

When my player goes onto some curved part of a mesh/model, it falls. Here is a part of the model rendered in SketchUp;

![alt text][2]

At the start/bottom of the loop, the player suddenly falls. The same thing happens to other models.

The mesh is a whole model that has a mesh collider. Straight surfaces seem to work but any surface which is in a different angle doesn't work.

The player is a mesh with a box collider. It is controlled by the script used here ( https://www.youtube.com/watch?v=hccdV0plvO4∈dex=5&list=PLmQnFpk1W81tyuEySbOJ4bG6Z1BrS_0hi ).

I've edited it but I think they're non-obtrusive additions.

 // JavaScript Document
 #pragma strict
 var forwardRate : float = 3;
 var turnRate : float = 2;
 
 public var idleAnimation : AnimationClip;
 public var walkAnimation : AnimationClip;
 public var runAnimation : AnimationClip;
 public var jumpPoseAnimation : AnimationClip;
 
 function Update () {
     Speedy();
 }
 
 function Speedy() {
         // tank's forward speed in action
     var forwardMoveAmount = Input.GetAxis("Vertical") * forwardRate;
     // force of the tank's turn
     var turnForce = Input.GetAxis("Horizontal") * turnRate;
     // rotate tank in action
     transform.Rotate(0,turnForce,0);
     transform.position += transform.forward * forwardMoveAmount * Time.deltaTime;
     
    if (Input.GetAxis("Vertical") > 0.2)
        animation.CrossFade (runAnimation.name);
    else
       animation.CrossFade (idleAnimation.name);
 }

I'd be so grateful for anybody who finds an answer.

[2]: /storage/temp/33074-screeny.jpg

screeny.jpg (376.8 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by lpye · Sep 29, 2014 at 03:01 PM

If I'm not mistaken, by manually adjusting the transform.position value you are essentially telling the engine "put this thing here, ignoring any physical properties". You are not giving the physics engine a chance to tell the model "hey, you can't move that way, you'll have to start going up the curved mesh surfaces".

I don't have the code at hand, but I had a similar problem I was working on but moving inside a tube. The code inside Speedy() should be calculating a force vector to apply rather than calculating the new position. By using RigidBody.AddForce() you are working "with" the physics engine instead of "against" it, telling the physics engine "hey, I'm nudging the physical thing this way, take it into account when you next calculate collisions and adjustments of position and orientation".

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tom-Featherhill · Sep 29, 2014 at 03:19 PM 0
Share

That makes a lot of sense! Thank you very much! I will try this right now.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Breakdown non-convex complex Meshes to Convex parts 2 Answers

Separating an animated mesh into parts 0 Answers

Wiring Script & Relaying Messages 0 Answers

How to create .blend models by script 1 Answer

Creating 2D collider from 3D mesh 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges