#Jump and Y (AXIS) constraint clash

1 messages · Page 1 of 1 (latest)

lapis schooner
#

Hi, I had a similar issue before and Asked some people but it was fixed for a moment.

From the second snippet, you can see I'm using "Vector 3 Create" (Node) to set the character's absolute Y value to 0. Why do I have to do this? Because I'm using Camera Relative movement with CineMachine's freelook camera.

The main purpose of using Camera Relative movement was so that I could create the well known "Press W and move around with mouse" effect. It worked, still works perfectly, but it has caused direct problems for other parts of character movement.

Mainly the Jump (And the exact same issue with Flying) is bugged out. I'm using Impulse (First Snippet), which is normally used for Jumping. I did some calculations and at double gravity, the character reaches back to the ground after 2.24 seconds, with a Y difference of 0.79.

That's not all, the jump is "Instant". As soon as I press Spacebar, it goes to 1.79 units INSTANTLY.

I did some debugging and mainly after creating a rigidbody default cube fall, I realized the issue is with my Y constraint within the actual movement script. Even if I press jump which has it's own graph (Not mixed with the player movement), the movement script still forces the constraint onto the character, causing the instant jump with the slow fall.

I want to remake the graph but I have no idea how I should go about doing that. Please help.

Thank you for reading this far and for providing advice! (Full Snippet for Character Movement will be in chat)

#

(Please ignore the caution on Animator as I'm in my testing workspace which does not have an animated character)

#

I have this new plan here:

Get Camera Forward → Set Y=0 → Normalize
Get Camera Right → Set Y=0 → Normalize
Multiply with Input (WASD)
Combine X/Z with Rigidbody.velocity.y → Vector3 Create
Set Rigidbody.velocity to that

But I have no idea how I would apply it. Help of any amount would be highly appreciated!

ivory bear
# lapis schooner Hi, I had a similar issue before and Asked some people but it was fixed for a mo...

I see a possible conflict in there because you have two nodes interacting with rigidbody

Set linearVelocity and addForce impulse.

Im not sure where the linearVelocity starts as its in a subgraph? I see an input...

And the input of set linear velocity doesnt look clear where it comes from because the screenshots are cut.

But i think it has a new vector x, 0, z) before it - so that 0 should affect jumping (specially when these graphs are flowing)

I usually do a "get linear speed get y" and connect y to that set linear velocity, while x and z are being received by control input .

This way it never interferes with altitude (jumping) and just adds velocity on x and z.

lapis schooner
lapis schooner
#

Okay it kind of worked, aside from this happening (And the character being LAUNCHED) when I press Spacebar

ivory bear
ivory bear
# lapis schooner Okay it kind of worked, aside from this happening (And the character being LAUNC...

Hmm wait. You say it happens when you press space bar?

Looks like you'll need to do one of these things (usually fixes my issues)

  1. restart unity. Its weird but sometimes random bugs stay. Restarting clears it.

  2. click the console log error and see where it takes you in the hierarchy or in your project files assets

  3. dismember your code. Right click certain white arrows to cut the flow and see if it happens again. See where it begins.

(It helps to change settings in project settings > editor > "do not reload scene or domain"

So starting playmode and stopping is blazing fast (seconds)

lapis schooner
#

This shouldn't be happening

#

I just realized, it's not even applying the force

ivory bear
lapis schooner
#

Actually, no, let me look at it right now (I fixed the raycast by the way, so it applies the force now)

ivory bear
#

yeah start there - watch that, and let me know if you found something useful or else we can continue to debug this

ivory bear
#

There's a node variation that allows you directly connect to Y input

lapis schooner
#

The issue is in the movement controller subgraph

#

This part specifically is the culprit (The only thing I changed)

ivory bear
ivory bear
lapis schooner
#

I tried to add this line from your message above it: "I usually do a "get linear speed get y" and connect y to that set linear velocity, while x and z are being received by control input ."

#

I may have misread it completely

#

This picture in particular which you sent

#

Also quick question, do you use a drawing tablet? That looks pressure sensitive drawing

ivory bear
#

glad it worked out for you