Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 JuanseCoello · Apr 13, 2015 at 10:34 PM · movementrigidbodyragdoll

How can I move a rigidbody ragdoll without velocity?

I have this code: TP_Controller.rb.velocity = MoveVector; where the rb stands for an array of child bones that move with the ragdoll.

ragdoll = transform.FindChild("Armature") as Transform; rb = ragdoll.GetComponentInChildren(typeof(Rigidbody)) as Rigidbody;

     Instance = this;

     animator = GetComponent<Animator>();


     rigidbodies = GetComponentsInChildren<Rigidbody>();

     int i = rigidbodies.Length;
     System.Array.Resize(ref rigidTransforms, i);
     System.Array.Resize(ref lastRigidPositions, i);
     System.Array.Resize(ref rigidVelocities, i);
     System.Array.Resize(ref lastRigidRotations, i);
     System.Array.Resize(ref rigidAngularVelocities, i);

     i = 0;
     foreach (Rigidbody rigidbody in rigidbodies)
     {
         rigidTransforms[i] = rigidbody.transform;
         i++;
     }

The problem is that I converted this rigid body character controller to a movevector, but to do that I have to take the velocity of the ragdoll. I want to use another instance that is not rb.velocity. But so far none of the ones like transform.position or so have worked.

Any ideas???

Comment
Add comment · Show 6
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 hexagonius · Apr 14, 2015 at 06:29 AM 0
Share

Can you rephrase? I don't even know what converting rigidbody character controller to move vector means? That's two different components converted to a vector? What was your intention again?

avatar image JuanseCoello · Apr 14, 2015 at 06:37 AM 0
Share

I have two scripts, one called Tp_$$anonymous$$otor and the other TP_Controller. This is how TP_$$anonymous$$otor works.

public static TP_$$anonymous$$otor Instance;

 public float $$anonymous$$oveSpeed = 20f;

 public float Gravity = 10f;


 public float Ter$$anonymous$$alVelocity = 20f;

 public Vector3 $$anonymous$$oveVector { get; set; }
 public float VerticalVelocity { get; set; }

 void Awake()  // Debe q$$anonymous$$rse en awake
 {
     Instance = this;
 }
 

public void Update$$anonymous$$otor() // Debe q$$anonymous$$rse en update motor { Process$$anonymous$$otion(); }

void Process$$anonymous$$otion() {

     // Transform $$anonymous$$oveVector to World Space
     $$anonymous$$oveVector = transform.TransformDirection($$anonymous$$oveVector);

     // Normalize $$anonymous$$oveVector if $$anonymous$$agnitude > 1
     if ($$anonymous$$oveVector.magnitude > 1)
         $$anonymous$$oveVector = Vector3.Normalize($$anonymous$$oveVector);

     // $$anonymous$$ultiply $$anonymous$$oveVector by $$anonymous$$oveSpeed
     $$anonymous$$oveVector *= $$anonymous$$oveSpeed;

     // Reapply VerticalVelocity $$anonymous$$oveVector.y

     $$anonymous$$oveVector = new Vector3($$anonymous$$oveVector.x, VerticalVelocity, $$anonymous$$oveVector.z);

     // Apply Gravity 
     ApplyGravity();
         
     // $$anonymous$$ove Character in World Space
     
     
     TP_Controller.rb.velocity = $$anonymous$$oveVector;
     
 }

 void ApplyGravity()
 {
     if (TP_Controller.Instance.isgrounded == true)
         return;

     if ($$anonymous$$oveVector.y < -Ter$$anonymous$$alVelocity)
         $$anonymous$$oveVector = new Vector3($$anonymous$$oveVector.x, $$anonymous$$oveVector.y - Gravity * Time.deltaTime, $$anonymous$$oveVector.z);
     if ((TP_Controller.Instance.isgrounded == false) && $$anonymous$$oveVector.y > -1)
         $$anonymous$$oveVector = new Vector3($$anonymous$$oveVector.x, - 12, $$anonymous$$oveVector.z);
 }

}

avatar image JuanseCoello · Apr 14, 2015 at 06:41 AM 0
Share

Basicalle I created a Vector 3 called $$anonymous$$oveVector, that manifests in 3 ways $$anonymous$$oveVector.x, VerticalVelocity, $$anonymous$$oveVector.z. But the other script has a ragdoll rigidbody, that controls all the childbones(that I put first). The problem is that I want to move all the bones as a whole, by converting rb wich is all the ragdolls rigidbodies, into $$anonymous$$oveVector. like this TP_Controller.rb.velocity = $$anonymous$$oveVector; but without using velocity.

avatar image hbalint1 · Apr 14, 2015 at 07:57 AM 1
Share

have you tried adding force with AddForce?

avatar image screenname_taken · Apr 14, 2015 at 08:48 AM 1
Share

Have you tried Rigidbody.$$anonymous$$ovePosition yet? http://docs.unity3d.com/ScriptReference/Rigidbody.$$anonymous$$ovePosition.html

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

21 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

Related Questions

Replace player with ragdoll 0 Answers

Moving rigidbodies at random 1 Answer

Implementing Counter-Movement 0 Answers

Disable ragdoll without changing Kinematic boolean? 2 Answers

rigidbody friction problem....HELP!! 1 Answer


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