#⚛️┃physics

1 messages · Page 85 of 1

neon solstice
#

But then it has been decided to set target FPS to 60

#

and my character started moving way slower

#

of course, I may increase forwardSpeed and other speeding constants, this will fix issue, I think. But.... I am curious - why movement was faster when FPS was rocketing to 400

viral ginkgo
#

@open escarp You gotta move those grabber arms with force

open escarp
viral ginkgo
#

@open escarp That would work if you want to use that

#

or maybe some joint motors

#

I'd prefer torque

#

Hmm, maybe joint motors would better though

open escarp
#

Thanks, I will try both

viral ginkgo
#

If you do torque, one arm might close fast while the other arm is pushing against the balls

#

It would be better to control the arm angles in a stable way

open escarp
#

Thanks

viral ginkgo
#

np

supple sparrow
#

you can gather input in Update but you should mess with rigidbodies only in FixedUpdate

neon solstice
timid dove
#

All of this Update code should be in FixedUpdate

dreamy pollen
#

Given two rotations, a and b, how do I determine the torque needed to move the Rigidbody from a to b, ignoring its mass (Forcemode.VelocityChange)

timid dove
#

not a difference in rotation

#

similar to how force gives you a change in velocity, not a distance

#

technically any amount of torque will get you to b (as long as it's in the right direction)

#

the question is how long will it take?

#

And at what angular velocity will you still be spinning when you get there?

dreamy pollen
#

I wish to move a dynamic rigidbody from rotation a to b over one frame, using AddTorque and subtracting its angularVelocity

timid dove
dreamy pollen
timid dove
#

We can also make that done with torque but it'd require a few more calculations with the current angularVelocity and the moment of inertia of the body

dreamy pollen
#

Another requirement I guess I should have mentioned is that I have to use the freeze rotation rigidbody constraints as I want to only move this dynamic body myself, with no consideration to any other rigidbodies

#

@timid dove

#

So I must use AddTorque

#

I usually just do something like this:
rb.AddTorque(torque - rb.angularVelocity, ForceMode.VelocityChange);

#

It appears I cannot set angularVelocity on a rigidbody with frozen rotation constraints, while AddTorque still works

#

(I recognize this is rather niche)

#

maybe I can get a signed angle delta on all 3 axes

timid dove
#

it won't let you get around rotation constraints being enabled

dreamy pollen
#

That is not true

#

unless Unity is bugged, AddTorque does let you circumvent constraints

timid dove
#

sounds like a bug to me

#

also doesn't make any sense 🤔

dreamy pollen
#

Possibly only ForceMode.VelocityChange has this effect

timid dove
#

that would be even more surprising than the previous revelation

dreamy pollen
#

give it a try 😐

#

(also, can we keep this on the down low? I don't want Unity to "fix" this... lol)

timid dove
#

later I will

dreamy pollen
#

@timid dove the following appears to have gotten me what I wanted:

Quaternion fromRotation = //...
Quaternion toRotation = //...

Quaternion deltaRotation = Quaternion.Inverse(fromRotation) * toRotation;
Vector3 deltaAngles = deltaRotation.eulerAngles;
if (deltaAngles.x > 180f) deltaAngles.x -= 360f;
if (deltaAngles.y > 180f) deltaAngles.y -= 360f;
if (deltaAngles.z > 180f) deltaAngles.z -= 360f;

rb.AddTorque(deltaAngles - rb.angularVelocity, ForceMode.VelocityChange);
nocturne lagoon
#

Hey everyone! ive been trying to make an online movement shooter but i keep running into this issue, i tried everything i could but could not figure out the issue 😦

#

Would really appreciate if anyone could help

#

using a Character Controller

#

Not using any particles

timid dove
nocturne lagoon