You have to think of a data structure for weapons that stores the weapon mesh so you can easily exchange the meshes.
Announcement
Collapse
No announcement yet.
Weapon Swapping?
Collapse
X
-
How about a scroll wheel weapon array? Store all the meshes in a array and just swap them as needed. Scroll input +1 or -1, add the axis value to the index. If the index is less than 0 then set the index to the array length or if the index is greater than the array length set the index to 0, otherwise set the mesh to the index.
Comment
-
Originally posted by Tactical_Beard View PostHow about a scroll wheel weapon array? Store all the meshes in a array and just swap them as needed. Scroll input +1 or -1, add the axis value to the index. If the index is less than 0 then set the index to the array length or if the index is greater than the array length set the index to 0, otherwise set the mesh to the index.
[ATTACH=CONFIG]106889[/ATTACH]
When I fire, I also get an error.
Comment
-
You missed a link.
See if that works, if not check that the array is populated. Add a print string with the string set to the scroll wheel value to make sure its firing properly. I'm not sure why your set skeletal mesh function doesn't have the reinit pose bool, this may be the reason for the error.Last edited by Tactical_Beard; 08-18-2016, 05:27 PM.
Comment
-
Originally posted by Tactical_Beard View PostYou missed a link.
[ATTACH=CONFIG]106914[/ATTACH]
See if that works, if not check that the array is populated. Add a print string with the string set to the scroll wheel value to make sure its firing properly. I'm not sure why your set skeletal mesh function doesn't have the reinit pose bool, this may be the reason for the error.
Comment
-
The only way to get thios working for me was to have all the Child Blueprints of the weapons IE RiflePU vs RifleBP.. attached to the player and hide them...
then used hide and unhide for each action... at the moment i see you using only FP_GUN as a base point for ALL weapons..
the issue i see is when you attach actor and remove its the first ORGINAL BLueprint or skelemesh...
remember things have a hard time removing the Memory location of the object and replacing it.. this is what potentially what you are doing
When you hide and unhide it wont ever but may cause collision issues later if not done right
using the SINGLE point of place and replace child actors may work with instances of the weapons... as removing them it still has ref to the orginal parent..
Love the logic though using arrays and stuff obervesly the efficient way to go...
Comment
-
Originally posted by Ozcorps View PostThe only way to get thios working for me was to have all the Child Blueprints of the weapons IE RiflePU vs RifleBP.. attached to the player and hide them...
then used hide and unhide for each action... at the moment i see you using only FP_GUN as a base point for ALL weapons..
the issue i see is when you attach actor and remove its the first ORGINAL BLueprint or skelemesh...
remember things have a hard time removing the Memory location of the object and replacing it.. this is what potentially what you are doing
When you hide and unhide it wont ever but may cause collision issues later if not done right
using the SINGLE point of place and replace child actors may work with instances of the weapons... as removing them it still has ref to the orginal parent..
Love the logic though using arrays and stuff obervesly the efficient way to go...
Comment
-
ok so first spawn youre weapons like normal .
so here in the screenshot i am spawning an assault rifle, and a rocket launcher both in the weaponSocket Location.
now i simply set one of the meshes to be hidden. in this case the rocket launcher because i want the assault rifle to be the default primary weapon
then its just a simple case of hiding one and showing the other when you wish to swap.
of course if you want more than two weapons you can simply use an array or enum to set the weapons visibility like others have suggested.
here is the result
hope this helps.
P.S you can tell i do too much programming now . look at the video upload title im so used to camelcasing i just do it automatically now without thinking and i actually find it hard to write normally :-pLast edited by EniGmaa; 08-19-2016, 02:33 PM.
Comment
-
Originally posted by Ozcorps View PostEniGmaa - You beat me too it lol NICE setup too
is it worse to do it in the Animation BP... ie bring the mesh ref over to be hit by notifys if you are using holster and armed animations
and
BlizzKrut - Look above =)
Comment
-
Originally posted by EniGmaa View Posthehe thanks. no there are multiple ways to do it. i was just showing him the simplest way that was like his original setup in the first post. and also because he said "i dont care about animations i just want it to switch"
Comment
Comment