Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 peter226 · Apr 04, 2018 at 06:03 PM · scripting problemphysicsrigidbodycollision detectionmoveposition

Rigidbody MovePosition doesnt use continous dynamic setting

So basically I have a box with a non-trigger collider that has a non-kinematic rigidbody with continous dynamic setting enabled for the collision detection, and if I apply force to the rigidbody it works as intended: if it has a high velocity it still detects intermediate collisions and does not go through thin colliders. BUT if I don't use addforce (because I'm making an AI script thingy that should move more realisticly instead of just sliding on the ground like it has skates or something), instead I use Rigidbody.MovePosition with the exact same setup with the cube and the wall the cube just goes through it if I set the movespeed to about like a running speed (works mostly fine if it has a small speed but still kinda goes into the wall). SO MY QUESTION IS: Is there a way to enable continous collision detection for the Rigidbody.MoveRotation (I mean like MoveRotation(DestPos,true); would be very useful), or is there a workaround with the results I'm looking for with like playing with addforce and stuff?

Here is the script btw:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class MovePosTester : MonoBehaviour {
 
     // Use this for initialization
     void Start () {
         
     }
     
     // Update is called once per frame
     void FixedUpdate () {
 
         if(Input.GetKey(KeyCode.K)){
             
             GetComponent<Rigidbody> ().MovePosition (transform.position + transform.forward * Time.fixedDeltaTime * 40.0f);
         }
     }
 }
 

And here are a the evidences :) : https://media.giphy.com/media/vcqhN9i2r2iaSfN818/giphy.gif

https://media.giphy.com/media/4YXWKbgFZy6lMpLdmv/giphy.gif

Comment
Add comment · Show 2
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 Gordrik · Apr 04, 2018 at 08:48 PM 0
Share

Have you tried using Debug.Log to check if transform.position of the object is correctly registered each frame?

avatar image peter226 Gordrik · Apr 06, 2018 at 04:04 PM 0
Share

I tried the rigidbody's position but it still doesn't work and if something would be correctly registered than it would be that. And if the transform's position wouldn't be correctly registered why would that be? What would cause such a thing and how to fix it? (btw I found a solution with adding a force like this: AddForce(desiredforce - rigidbody.velocity * 9); but this makes it much harder to push my mobs around on the ground, but at least they aren't skating around and falling off cliffs. I would still like to find a better solution for this tho.)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Arqae · Aug 24, 2019 at 03:20 PM

Way out in the future, but if you found a solution i would be happy to know :)

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 peter226 · Aug 25, 2019 at 12:55 PM 0
Share

@Arqae No, I didn't really touch that project since, I guess a dirty solution would be using a capsule, box or sphere collider on the object and doing a Physics.CapsuleCast, BoxCast or SphereCast in the direction that the object is moving in, and see where it would hit the wall and stop it there, or do a Rigidbody.SweepTest maybe

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.

Follow this Question

Answers Answers and Comments

201 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make Rigidbody.AddForce less delayed in Unity3D? 0 Answers

Cancelling Force of Rigidbody for new Direction 2 Answers

ball's collider sometimes catches an edge and bounces. when ball rolls over two aligned platforms 1 Answer

Object jumps right after the attached HingeJoint2D is Enabled 0 Answers

Script isn't consistent 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges