#hinge sensitivity
1 messages · Page 1 of 1 (latest)
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.
i don't know
i've been trying to fix it by removing the + mouse.viewsizex but it still didn't work
i tried even dividing more
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.
wdym
(also sorry for very late reply)
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.
i have a little problem though. the turret mesh is like rotated when first imported, the "Front" side is actually the right
That just means you'll have to apply an offset of +/- 90 degrees.
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.
Here's an example of what the functioning code might look like.
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.
You'll want to refer to https://create.roblox.com/docs/physics/network-ownership for more info about network ownership.
sorry for being unbelievably late, but after looking at the code a bit i took ideas and implemented it into my script, also improved it, and it worked really well. thanks
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 are you there
hello!
so, what changes have you made so far?
been still trying to tweak the hinge, still doesn't work. the left-right one works tho perfectly
where do you directly update the hinge properties?
or is that being handled by the remoteevent? (if so, which one?)
a single remotevent, the hinge properties changed by the normal hinge properties, nothing else