The calculations come from the GetPosition function. The update method moves the balls based off of the GetPosition function using time as an input. When a ball collides in the demo I calculate a new init velocity and have the ball go in that direction. (this logic occurs in the OnHit function) (yes, I did consider signals I felt they did not fit the simple concept I was going for) Bouncing is not a default behavior. If you want bouncing, projectile piercing, or any kind of custom logic to occur you have to code it yourself. All this module does is take in your projectile object, the settings, and move the ball.
No problem! If you make anything with it post it. I would love to see it in action. : )
I am probably going to add a github repo, and a rewrite of the post. I just have to wait for my classes to finish up this semester first.
I set it up like in your post and I’m getting this error: “SimpleCast:160: invalid argument #1 to ‘clone’ (table expected, got nil)”
Fixed it by changing it to this:
function CastCache:ExpandCache(size)
for i = 1, size do
local obj = self._obj:Clone()
obj.Parent = self.CacheDump
table.insert(self._dead, {
Object = obj,
InitVelocity = ZERO_VECTOR,
InitPosition = ZERO_VECTOR,
LifeTime = 0,
Data = table.clone(self._customData or {})
})
end
end
This is a wonderful module, works very well. I do have an issue with attempting to create a passing sound for when a projectile passes a player, to initiate other things like suppression, etc. Could anyone help me in finding out how to accomplish this using this module?
So I was actually thinking about this a few days ago. I think this can be handled many ways actually. One is was comparing the distance of the characters and if they are within the proper distance do the suppression. (use OnCastMove for this)
There may be another method you could use with dot product. On firing find out if the player is in the proper angle range. Keep track of all the players within that range and check when the bullet passes by them. This is similar to the last method but you are not checking the entire list of players every time the projectile moves. (Use CustomData and OnCastMove for this)
Info on dot product:
To further add onto the power of dot product you can add bullet magnetism using dot product. I actually implemented that in a really old version of FastCast a few years ago. (you see bullet magnetism in COD and Halo it is to help projectile bullets hit their targets. You can see the effect quite a lot in the Needler from Halo.)
Exactly what I was looking for!
Am needing a bit of help if like networking a gun cause the gun system i made prior was all server based with fastcast, however I want to swap to something client based (as this) to make the guns more responsive and not dependant on ping
In the demo place it has some basic networking. Let me know if you have any other questions.
Hi, I want to start off with thanking you for making such a great asset free.
I would like to use this module to replace the FastCast module within my gun kit and I’d like to edit this to suit my needs. Is that okay? Would I be allowed to release said edits as well?
Of course I’d give you credit but if you’d prefer that I not release it that’s perfectly fine!
Thanks for this though.
That is totally fine. I would like to know what edits you are making because I am always looking to improve the module. If they are specific to your project I do not need to know.
Thanks for the quick response,
My edits are specific to my project - I’m trying to make a really realistic gun system. I want to re-add penetration with some improvements (in my opinion) and add ricocheting as a function within the module. I could just use FastCasting but I think this is a great groundwork and is far more readable and user-friendly.
Also, are any future updates for this module planned / in the works already or will you just do updates when features are requested?
That sounds pretty cool! I probably won’t ever added penetration or ricocheting since like you observed I am trying to lay good groundwork for people’s projects.
Let me know how your project goes. I love to see videos or play demos.
I also do not have any major updates planned as of now. I do plan to put a repo on Github and probably rewrite the original post. I will do updates if requested. (depends on the update. If it strays to far away from the original goal of being “simple” then I will not add it.) Do you have any suggestions?
Edit: I do have one update in mind. It is the ability to have a SharedCache between Casters.
Thanks. I’ll be sure to send some videos and link some games when I get some substantial work done!
A repository on GitHub would be fantastic. Unfortunately I don’t have many suggestions - just stumbled across this and I’m just playing about with it right now, but one could be to have trails built-in - not sure how this could be achieved but I could try prototyping my implementation then send it to you?
I’m a bit of a noob when it comes to stuff like this - I can script but I’m not an expert . What is a SharedCache?
So when I say Cache I am referring to “Object Pooling Design Pattern”.
If we go back to FastCast you have to create a new instance of your bullet every time you fire. (Unless you implement PartCache then you can avoid that) I decided that SimpleCast will have its Cache built in so you can pass it your bullet instance and it will create them for you and pool them.
My idea for a SharedCache is, “what if we have more then one caster that uses the same bullet instance?”. Currently, if you set up two casters with the same instance you would have two caches. The main reason I have not added it yet is because the big question of, “will this really improve performance?” is still bugging me. I need to do some testing to find out if it would be helpful.
That sounds really interesting. If you don’t end up doing it, would you mind if I implemented this concept into my edit?
Sure I do not mind at all. Good luck on your project.
idk how to use it bwuh maybe pls halp nvm aisle do it mysalf