hello. How can I change actors when my character kills my enemy?
here I have the two actors
inside the goomba
inside mario
hello. How can I change actors when my character kills my enemy?
here I have the two actors
inside the goomba
inside mario
so you want to possess a new goomba when mario kills one? what problem are you getting the code looks ok
Exactly, the idea is that when I crush goomba it transforms into a crushed goomba actor
Typically, what people do, is animate the crushing, and use the same mesh, just with an animation (blend animation or skeletal animation) that makes it squished.
However, if you have two different meshes, you can do one of two things:
I highly recommend using the animation if you can, and if not, swapping the mesh, not the entire pawn/controller setup.
looking at your code your turning mario into a goomba ha,
if your just changing the mesh then jwatte has your answer above
Thanks for responding, can you be more specific? show graphically why I’m lost like this
you can get the skeletal mesh, use setskeletalmesh and point to your squashed goomba mesh.
or you could play around with the scale, you could set/lerp the Z scale from 1 to 0.1 might look wonky but would give you a nice smooth transition on lerp
I don’t understand what’s unclear. Maybe the confusion is about what an “actor” is, as opposed to a “mesh component” or a “mesh asset?”
An “actor” is a game object that has a certain behavior, can get replicated to networked clients, and so on.
An “actor” doesn’t, by itself, show up on the screen – it needs to use some kind of mesh.
If you want an “actor” to look different, you can change the mesh it uses.
Meshes are typically rendered by a “Static Mesh Component” or a “Skeletal Mesh Component,” which reference a mesh asset of the right kind (Static Mesh or Skeletal Mesh.)
Thus, to make the “enemy” actor render “a squished goomba” instead of “a full-size goomba,” one of the ways of doing that is to replace the Skeletal Mesh in the Skeletal Mesh component from a “full size” mesh asset, to a “squished” mesh asset.
If the squished mesh asset has a different skeleton, you’ll also want to change the animation blueprint to match.
(If you use static meshes instead, the static mesh components has not direct animation, so that doesn’t matter there.)
If you have an AIController, the AIController should probably know whether it is “squished” or not, to stop moving, for example. Or if your enemy subclasses Character, you can set the movement mode to custom, and max speed to 0, which will make it not move.
Do not destroy here, this is the Mario BP, you’ll destroy Mario…
we are achieving it. I would only like if it can be achieved as a rebound when colliding with the goomba and that when it is crushed, it disappears in a second later
Launch
the character up, or call Jump
. Launch might be better as you might have exceeded the number of allowed jumps at this point.
Great, and how would I make the squashed goomba disappear after a few seconds?
You could Set Actor Life Span, needs no nodes and automatically destroys an actor after x seconds. Search for it in the detail panel of the actor.
Or Begin Play → Delay → Destroy
It turned out perfect, thank you very much