Making controllable turrets that 'stay upright' while aiming
This was incredibly difficult to explain, and I'm fairly sure I really didn't do it well even with this draft, so sorry about that. If you can't understand what I'm trying to say here, let me know!
I've spent quite a few days trying to create a turret that rotates around a pivot (provided by a ball joint) with standard/advanced rotators controlled by the player with the DS4 analogue sticks. The plan was to have a camera grouped with the moving part of the turret, so that when possessed (or controlled via logic in the scene) the camera would jump to its position beside the turret and the player would be able to control it as if it were a weapon in a FPS game, but to be clear my problem would still be there even if we didn't take the camera in consideration.
To make a good turret, I want to make the turret (its moving part) rotate in only two of its local space axises. Specifically, I want to let it yaw and pitch, but not roll, which means that I want the turret to aim around while keeping the relative angle of its body fixed to where it's aiming at, instead of letting it rotate around it. Since I can't really explain it properly, think of the movement of a rifle in a FPS game and how it moves in the 3D space.
I've tried various methods but never managed to achieve this: the turret will inevitably roll and its position will mess the turret's visual look (it will look like I'm aiming it sideways) and, since its grouped with it, the player's camera view.
Advanced rotators's dampening does not appear to work (I believe this is a known problem) so I can't use them to stop the turret from rolling, and they also tend to act wildly when used with ball joints (an advanced rotator with a single axis rotation active will make my turret move in all directions for some reason). I get better results with multiple standard rotators, two used for yaw and pitch and one set to 0 speed with full strength and dampening to stop the rolling, but the problem is that while moving the turret attached to the parent with a ball joint will inevitably roll a little due to the restrain, and the angle will keep accumulating until the turret is completely upside down.
Changing the ball joint's strength only makes the rotation slower, and locking the rotation will only stop the turret from going upside down: it will go wild once it reaches the edge of the ball joint's 3D angle, and the roll will still happen in other positions while rotating.
I've tried to think of possible solutions, like using 'look-at' rotators or trying to set up a stabilizing system with multiple rotators set to the roll axis and an angle sensor controlling them, but I'm not sure if any of them can work for what I'm trying to do. If you have any ideas, I'd be happy to hear them. Thank you!
-
Hi,
If you use a look at rotator it has a stay upright tweak. Maybe that can help you.
Or use a gyroscope with your existing set up, that always helps
John -
I've already tried using the gyroscope, but it doesn't really work for what I'm trying to achieve since it will try to keep the entire turret upright to the ground, with only one direction of rotation permitted. It works when aiming left and right and it does fix the 'rolling' problem', but when aiming up and down it becomes very difficult to control the turret as the gyroscope will always try to move it back to its starting position.
I have yet to try to use a look-at rotator with the set up, to be honest I didn't use it all since I got the beta. I'll go and see if I can work with that later. Thanks for the reply John. -
Hey, just in case someone reads this I just wanted to say that I may have found a solution!
For the record, the 'look at' rotator with the upright option does a good job, but then there is the problem on deciding how to let the player move the tag the rotator is looking for. I tried stamping a large sphere (roughly) centered on the ball joint, controlling it with an advanced rotator and then stamping a tag on it. It works, but sadly the 'rolling' problem will arise again because once the sphere starts to randomly roll (even without the proper axis input) the player stick input will start to change their effect on the sphere's movement (to the point where the movement inverts itself completely).
I was beginning to think that maybe this was not possible, when I thought about looking through the community to see if anyone tried this already. Nobody tried to create a turret exactly like I did, but I found an FPS setup that has a very, very interesting setup for its camera! Basically, the idea is using two cube sculpts, one (the base) controlled by an advanced rotator active only on the y axis (look left and right) and the other one (above the base) controlled by another rotator, this one active on the z axis (look up and down), and use a simple bolt to connect them (with the pink gizmo moved by the second sculpt's side). This way, you only let the object on the top (the camera in the FPS setup I found, but anything really, including my turret's barrel) yaw and pitch but not roll, exactly like I wanted! I don't have time to try it today, but I'm pretty sure it will work.
I have to thank MM for making it so simple for dreamers to share all kinds of stuff and not just full levels, and for letting us look through said stuff so easily. After more than three weeks in the beta I've started to believe this is a game changer compared to LBP. -
I was trying to solve this too, and after some experimentation I succeeded at building a "freecam rig". it controls almost exactly like Dreams' built-in camera editor (what you get when you L1+X on a camera). https://indreams.me/element/oGCQNsJjHmQ
I shared it with you; have a look.
Por favor, entrar para comentar.