#hinge sensitivity

1 messages · Page 1 of 1 (latest)

jagged hound
#

i scripted it so the hinge constraint should follow the cursor, and it does, but it's too sensitive. i kind of need help fixing it

visual iris
#

Are you sure the issue is with the hinge sensitivity?

#

Target angle is probably relative to the hinge itself. Your assignment to mouse.X + … doesn’t really feel sensical.

jagged hound
#

i've been trying to fix it by removing the + mouse.viewsizex but it still didn't work

#

i tried even dividing more

visual iris
#

Try playing around with the angle manually. Does it overextend? If not, then you know the problem is with your assignment.

#

You’re just throwing numbers at it right now hoping it’ll solve the problem, but that’s likely to just get you stuck.

#

This is probably going to involve a bit of vector math to actually assign the angle.

jagged hound
#

(also sorry for very late reply)

visual iris
#

The assigned angle is relative to the direction of the hinge (which is in turn based off the attachment). We want to assign this angle based off the mouse, so we'll use mouse.Hit to get the relative position of the mouse in 3D space. We now need to find the angle between the LookVector (the direction it is facing) of the Hinge and the "vector" (mathematically, we'll pretend one is there. it makes the logic easier) between the Hinge start and Mouse position.

jagged hound
visual iris
#

That just means you'll have to apply an offset of +/- 90 degrees.

jagged hound
#

oh

#

like this?

visual iris
#

It's a fair bit more complicated than that.

#

Remember -- scalars aren't vectors.

#

Mouse.X is just a number measuring the distance, in pixels, your Mouse is from the left of the screen.

#

CFrame.LookVector is a vector value, composed of 3 scalars, which tell us where the Turret is facing.

visual iris
#

It consists of 2 scripts: AimController in StarterPlayerScripts and AimReplicator in the turret model (this is bad practice though! keep your scripts in ServerScriptService. I only do this to simplify the example).

#

AimController calculates a degree offset value for the hinge, then fires a remote event which will be acted upon by the AimReplicator. This networking step may not be necessary in a tank. It is necessary here because the Base is anchored, and thus the entire mechanism is server-owned.

jagged hound
visual iris
#

glad to hear

jagged hound
# visual iris glad to hear

also can you help with the turret hinge please, you know the one that goes up and down, i've been tweaking the script for a while and can't figure it out

#

the angley is supposed to be the hinge btw

visual iris
#

hello!

visual iris
jagged hound
visual iris
#

where do you directly update the hinge properties?

#

or is that being handled by the remoteevent? (if so, which one?)

jagged hound