SimpleCast - An Alternative to FastCast

I suppose it depends on where you want the simplicity. I wanted it in setting up a caster to fire a bullet which FastCast did not give me.

Code wise, I did this following the usual roblox OOP method with metatables. What parts of the code do you feel hard to absorb?

hey, does this have pierce function?

1 Like

If I wanted to handle projectiles, would i simply just migrate this module to the sever?

1 Like

One issue I find is that I find it difficult to sync up my SimpleCast projectiles ran on the Server with the Simple Cast Visual effects on the Client. If i want to detect collisions with SimpleCast on the Server and move my VFX on the client with Simple Cast, I just canā€™t get them to sync up properly in the same position.

Not built in. You can write one yourself however.

This is a common issue with many server to client or client to server stuff. Latency is causing this. There is actually a module floating around that handles this by default. I think it is called ServerCast? I could be wrong.

I was able to fix this by replicating the projectileā€™s vector from the server to the client. What I was doing before was creating another vector on the client, resulting in the VFX going in a different direction compared to the hitbox on the server. But I also noticed another issue while using this module:

What should I do?

This is because your creating a new caster without deleting the old one.

1 Like

Ok, I figured out how to get rid of this, but for futureā€™s sake, how would I go about deleting an already constructed caster? Would i just set Caster to nil?

when you do local myCaster = SimpleCast.new()
do

myCaster:Destroy() to remove it.

Oh I just read the API and I realized that was a method :joy: sorry about that.

Now I know that the hitboxes already ignore hitboxes of the same Part, But what if two different hitbox parts are interacting with each other? How would I make those ignore each other too? Would I make it ignore parts in the Cache?

Can someone create a guide on how to set this up? I want to use this over FastCast since I need a more simple, updated (as in having someone to look after the module) and performative (not sure if this is for sure the case though) system for my small game, however unfortunately I canā€™t understand the code fully and set it up properly.

If there are any guides I donā€™t know of I would be thankful! (I didnā€™t find any explanations besides the ones in the contents of this post)

1 Like

Is the example place not enough? What are you stuck on?

Could I do actual zeroing in this game? As in I can have a variable set to 300 studs and run a function and see how many angles I bump the projectile by to get it to hit 300 studs out?

Sure, you just have to do the math.

I understand you can return the end position of one hit but is there a way to get the end position from a part that bounces multiple times before firing?

1 Like

do a for loop with the step being pretty small. like 0.01. The demo place has an example of this.

can you implement blockcast and spherecast (for bigger hitboxes)? fastcast doesnt have that

1 Like

This would be pretty cool to implement. I will do this when I finish this semester.

Thanks for the suggestion.

4 Likes

Is there any way to have the projectile pierce specific parts? My use case is I want to pierce through characters, but Iā€™m unsure how to achieve this with your module.

Appreciate it.

Edit: I temporarily solved this by just adding a check in your _update function. If OnCastHit returns true, the projectile continues. I would still like to see a better alternative, however.