I wanted to make a fully functional star destroyer. (not to size but still very large) and I was curious on how I would go about making it drivable. Would I use Tweening? CFrame? etc. Would I move it on the server or make every client replicate it? etc.
I have no experience in this type of thing.
For the controls, rather than someone on a seat controlling the entire ship, I was thinking of making it so that a button makes it go forward/backwards. Same with left and right. Therefore, there would be set variables that determines its velocity and orientation. I would like advice on how to implement this.
Also, I was wondering if anyone knew how to make parts of a model destructable. I want to make a thing (anchored/welded) that can still be destroyed by explosions. The explosion will happen when a part touches it. Do I make everything in a certain radius of that part unanchored? Etc.
here’s my approach to doing it (not tested):
1 - (the most important) make your model optimized, make sure you minimize part counts where you can
2 - if you want your model to be knocked around or interact with the physics enviroment, then you can use the (arguably) laggier unanchored physics.
3 - presuming that you will make it anchored, here’s how i would do it:
- at a tick rate of the physics heartbeat except around 4x slower, you want to determine your moving direction.
- multiply this direction by some amount to represent where you’ll be in a certain amount of time, now divide this trajectory into nodes, and tween them.
- everytime you reach a node, check if the next node is making contact with something using shapecasts and collider blocks (you’ll figure it out)
- now if it doesn’t register anything that’s too close then it’ll tween to that position using the time to target equation (t = distance / velocity)
- in the case that it does detect something, give a collision warning and then (stop the ship? i don’t know how you want this to behave, ur choice)
anyways. that’s how i would do it, as anchored models are the least laggy i’d say.
now for destruction, there’s two ways to do this:
1 - take the ship structure and divide it into chunks while putting that into a “destruction” version of the model somewhere in your game.
2 - or, just use the ship parts.
when a part gets knocked off, send a remote event or signal to all clients to clone the part and what velocity it should have. then, destroy the part that was hit. we use clients to manage debris as it is the most optimized method for physics and loose parts. now, if i were you i’d make these debris non collidable and disable canquery in order to reduce lag and incase the parts desync it doesn’t create any clientside movement issues etc. the clients parent the debris to some folder in workspace, use debrisservice to give them a life span, and then unanchor and apply the velocity.
oh, and for how to tween, always tween on the client, specifically on the client of whoever is piloting the star destroyer. then, signal to other clients to tween to the same position, then once you reach a node send to the server your CFrame, this way you get smooth tweens as well as having the server marginally keep up with the client position.
this might be a bit complicated, but uh…

yw
1 Like
I’m flabbergasted. Bamboozled. Shocked. Awed. Amazed. You really got me twinkling my toes.
I somewhat understand what you are saying but let me give you some more context.
- As I said, it’s based off spaceships, etc.
- there is 0 gravity and is taking place in space (like a space battle)
- the ship is not going to be moving fast
- for the steering, as I mentioned, it will be using click detectors, there will be a panel where you can control what direction the ship is going in. (trying to make it realistic)
- the velocity for the exploding parts will be created like this:
a: a part (bomb) hits the ship
b: a shapecast is used to determine all parts in its radius
c: all parts in radius are unanchored and debris service is applied
d: an explosion will be made (applying velocity to these parts)
- since it is a space battle, there will be two big main ships that will most likely NOT touch. The smaller fighters will just explode upon contact with the ship if they are moving at a fast speed so there is no need to stop the ship. Just like how an airplane doesnt stop if it hits a bird, just takes the hit and keeps on going
lmk if this changes your answer in any way
actually now that i think about it you could prohibit the ships from crossing a specific boundary in the halfway mark of the map so they never touch.
I’m not sure if the :SetPrimaryPartCFrame
or :PivotTo
function’s will cause lag but if you could give it a shot.
It is late here so I wont be able to asset you further
if two big spaceships touch then I can just make big boom. EX: star destroying colliding with another one. So there’s no need for all that, I’ll just make them explode
1 Like
you might have problems with people trying to grief matches by purposely crashing ships together
not everyone will have access to the control room.
1 Like