Physics upon initial creation dilemma

They clearly have travel time, if I wanted them to travel along a ray I would have done that by now and I already stated that I wanted to refrain from cframing it. This isn’t answering my question at all.

I will give this a shot

You do realize you can add travel time via Rays right…?

1 Like

Can you elaborate, I am not sure you’re talking about the same thing I was.

1 Like

Lets propose you’re trying to arch your bows, like I stated.

If you merely add a simple wait, or have the arch register a new angle during a runservice, etc… that adds a good amount of travel delay. But as I stated, that’s with archs (which I’m assuming you’ll have due to it being a bow)

1 Like

The projectile code is already on the server side. It would be difficult to sync it with the animation if there was any server delay if I had to create the arrows and then wait an unknown time for them to appear.

What about the option of the server just using :FireAllClients(), and each client creating their own version of the arrows, so that it looks smooth on their screen? You could just provide the starting position and make each client use the exact same function so it all replicates - pretty much - the same.

I don’t want any delay. That is the whole point of this post. This is happening even if i simply just shoot a block out using a velocity. I just want it to travel in a straight line. If I had it following a ray I would have to interpolate its cframe from start to end and constantly check to see if it is colliding using rays, which I already stated that I wanted to refrain from doing.

1 Like

I would have to check collision on all of them, and say all of them hit something to deal damage. The server would receive 8 hits from 1 ability.

Wouldn’t using :FireAllClients() be used for cosmetics only? You only need to do the actual damage mechanics with the player who is firing it, and you could choose how the damage is worked out.

4 Likes

I will give this a try, thank you. A quick question though. How will i detect when the arrow has touched something if it isn’t created on the server? Would I just create an invisible server version that is happening? That might make it look like things hit something when they really didn’t or vice versa.

Setting it to massless doesn’t affect it when you’re using a bodyvelocity because the bodyvelocity negates gravity anyways

Hm, that is a valid point.
I tested this with a gun system before, with a server side check on if there is actually somebody where the person says there is, however, due to the latency between client and server, and because gun fights are very active and people move around a lot, the server wouldn’t “see” anyone at that position and reject it.

An alternative would be to do the check on the client for the collision - but that opens up a major vulnerability - so I guess this method may not be the best solution, unless you come up with a good solution. Sorry

1 Like

I’m going to create all of the effects on the client.Checking the collision on the client is a big no no so I am not going to do that. I will just simulate the movement of the objects on the server by just calculating the position and raycasting from that position to check for collision. I’ve decided this is the best way instead of using phsysics. I guess the only downside would be that if there is a decent amount of server lag it would look like it hit the target on the client but not the server side. My application won’t be as intense and will be more forgiving than a shooter game so I will sacrifice this to make everything look smooth.

I’m working on a utilities module that introduces arcs that are similar to rays. You might be able to use those?

thats not what i meant i said to set it to massless when you use a vectorforce becuase vectorforce does not negate gravity and it has a drop but anyways it would not help because massless objects are effected by gravity

Create a box somewhere in workspace that contains all the projectiles for each player when they join the game. Have the network owner set at this time too so there’s no network switching that would cause the hop you’re seeing. When firing, just change the position and reset any scripts associated with the projectile. When it’s ready to be deleted, just move the position back and stop any scripts for the projectile. You can force it to create a new projectile in the box if it falls into the void too using the AncestryChanged event.

1 Like

that’s not a bad idea. I might use it later, but for now I will create everything client side and simulate everything with ray cast and cframe.

1 Like

I was just wondering, seeing as your arrows do have travel time - do you plan to incorporate this in your server side collision check?

I am simulating the server side movement of the arrows by interpolating from the start cframe to the end and check the collision with ray casts every step. And then doing the same thing on the client but I am cframing the actual arrow.