Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 RaulG · Aug 02, 2013 at 04:29 AM · rigidbodyforcesending object

Trying to move an object when I click my LMB

I'm currently using: HookChild.rigidbody.AddRelativeForce(HookHit.point * speed);

Which worked somewhat. But still not completely right.

The problem is giving it a ForceMode sends it flying in the wrong direction, but not giving it a Forcemode makes it move very very slowly.

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 chronicfail · Aug 02, 2013 at 07:14 AM 0
Share

It sounds like you need to use something more like HookChild.rigidbody.AddForceAtPosition(transform.forward*speed,HookHit.point);

avatar image RaulG · Aug 02, 2013 at 07:54 PM 0
Share

Doesn't seem to be working at all. I'll keep messing around with that.

Either A: It's not counting in speed. or B: It doesn't move towards HookHit.point.

Right now it's both.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Xtro · Aug 02, 2013 at 02:24 PM

I'd rather prefer to enable the IsKinematic flag on the rigidbody and make it move by transformation. After the dragging event ends, I'd disable IsKinematic back.

Even if the object a rigidbody, dragging it doesn't have to be a force movement.

Comment
Add comment · Show 4 · 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 RaulG · Aug 02, 2013 at 07:51 PM 0
Share

Okay explain that. How?

avatar image Jamora · Aug 02, 2013 at 08:18 PM 1
Share

He means set [ridigbody.is$$anonymous$$inematic][1] = true;, then use trasform.Translate or directly modify the transform. Finally set is$$anonymous$$inematic = false.

[1]: http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-is$$anonymous$$inematic.html

avatar image RaulG · Aug 02, 2013 at 08:29 PM 0
Share

Oddly that still seems to cause that annoying snap movement.

  if (Input.Get$$anonymous$$ouseButtonDown(0))
            {
                 HookChild.rigidbody.is$$anonymous$$inematic = true;
              if(Physics.Raycast(HookRay, out HookHit, 50.0f) == true)
              {
                 
                  HookShot = true;
                   Debug.DrawRay(HookRay.origin,HookRay.direction, Color.red);
                    Debug.Log("Hook was hit");
                  HookChild.Translate(Vector3.$$anonymous$$oveTowards(Player.position,HookHit.point,$$anonymous$$athf.Infinity));
                  Debug.Log(HookChild.rigidbody.is$$anonymous$$inematic);
                  //HookChild.rigidbody.AddForceAtPosition(HookChild.right * speed,HookHit.point);
                  RopeChild.localRotation = Quaternion.LookRotation(Player.transform.forward,HookHit.point);
                  RopeChild.localScale += rope$$anonymous$$oveTowards * Time.deltaTime;
              }
            }
avatar image RaulG · Aug 03, 2013 at 02:22 AM 0
Share

So using HookChild.rigidbody.is$$anonymous$$inematic = true; causes my HookObject to not be destroyed until the next time I use the Destroy(HookChild.gameObject) again.

And just using the transform causes it to snap.

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

17 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

Related Questions

Reading the forces applied on a freezed rigidbody(solved) 1 Answer

Unity First person controller force and mass 0 Answers

maximum torque/maximum force 0 Answers

Rigidbody velocity has got different direction than VelocityChange force vector 1 Answer

Adding Rigidbody to an Object on Collision by Raycast? 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