- Home /
How could I combine melee weapons and rays?
Hi guys, in my next game I wanna do something like this video...
https://www.youtube.com/watch?v=FS28pemV0Tw
That was UE3. This is better than a boxcollider or a mesh collider, because it's not posible jumping the collision when the animation is really fast. I'm not asking the source code of something like this, (if exist an asset, great =P ). I tried to do that but the problem is calculate the position where the ray born when the mesh is animating. Any idea?
Could you just cast a ray from the bottom of the lance to the tip of it, then if the ray hits a tagged game object "enemy" apply damage?
I'm slightly confused about what exactly it is you'd like to emulate. Are you trying to plot the movement of the weapon? Or are you trying to find all parts of the attack that deal damage to something?
Answer by ddfire · Oct 02, 2014 at 05:13 PM
Hope this help Do not cast the Ray always, only when the character is attacking, then once per frame (update() or similar) cast the ray, and cast it from the point of the spear or the part of the weapon that suppose to hit the other character, cast in with direction forward relative to the hit area of the weapon. Probably you will need to add a dummy GameObject in the hit area of the weapon pointing forward, and you will raycast from there.
Maybe you will want to set an event in the animation and start raycasting when you are hitting and not charging. Hope this help. David
Your answer
Follow this Question
Related Questions
Melee system: colliders, raycast, or other way? 0 Answers
Crosshair and Ray 1 Answer
2D melee Combat with SphereCastAll Problem 1 Answer
Help with ray cast 4 Answers