I’d read the thread to get an idea what;s already been tried but if you can’t be bothered then I’ll summarise:
To fire a projectile by spawning a destructible object when the left button is pressed - DONE
Have the power of that projectile be determined by how long the mouse button is held down for - DONE
Have a camera (a scene component of the projectile, on a spring arm) be set to the new view camera, and when the projectile is destroyed, swap back to the default camera - DONE
Have the camera (a scene component of the projectile, on a spring arm) follow the projectile on it’s path to destruction - FAILED
So as you can see, most of it is done but the camera view (lets call it cannon-cam for ease) does not move with the projectile. It stays at the point of origin for the projectile rather than following it.
I’ve tried everything I can think of, from creating a new camera separate to the projectile and attaching it etc but nothing works.
If anybody could figure this out I’d be very happy. I don’t think I need to reinvent the wheel here, I have almost everything already in place except for the camera actually following the projectile.
Thanks in advance for any help, it will be appreciated.
The Camera is in the Projectile, yes and I do a Set View Blend inside the projectile Event Graph, targetted to self - which should search the components for a camera component and use it as the view target if there is one. This bit of it works, it does indeed use the new camera and swap back when it should.
The problem is the camera does not move with the projectile on its journey into the air!
Rather than me reposting all the images and such I linked in the AnswersHub thread where all the status so far is posted, with images etc.
If that’s a problem, let me know and I’ll see if I can post them here too.
The first shows just ONE of the hierarchies I’ve tried but is the one I’m currently using. I’ve tried moving these around, getting rid of the Root component, creating a new one, removing the spring-arm, having the camera as a root. making another camera, etc.
The second and third pic are the same Graph view, but with the Spring-Arm and the Camera selected so the info on the right-hand panel is different, to give an insight into the settings.
Does your camera follows a projectile if don’t blend to it. For example if you just drag cannoball into the editor and let if fall?
Another thing I would check is to start blend somewhere not at the BeginPlay, just to make sure that all components are spawned already (they should be, but maybe there is a bug).
I haven’t tried just dragging it into the editor actually, but I’ll try that later when I get home.
The Begin Play is on the Cannonball Blueprint of which a new instance is created every time I fire the projectile, so it’s not actually on the game starting but rather when the projectile is spawned - if you get me? Besides, I’ve tried it being triggered from Left Mouse Button Released as well and that didn’t make a difference.
Yeah, I did got your idea and it should work perfectly, just trying to narrow down the source of the issue.
Some other ideas:
your cannonball is not a pawn right? Because if it’s not than you shouldn’t set Use Pawn Control Rotation or any other setting which would try to grab location rotation from a pawn instead of controller. But I’m not sure here how default behavior is suppose to be
do you have two other camera components? i don’t see them in hierarchy but I can see them in the list of components. Try removing them because SetViewTargetWithBlend will grab one of the cameras in the actor you providing as NewViewTarget. better be sure it grabs a proper one
I created a destructible mesh (my cannonball) and made this into a Blueprint, then added my other components inside its hierarchy. I don’t think I’m doing anything odd with it, but I can post my other graphs later when I get chance, see if you can spot anything odd I’m doing (Level Blueprint and First Person Blueprint).
Those two other camera component variables are now deleted. On that screenshot they were leftovers from some failed attempts so I removed them and now the only camera component in there is the one I want it to use. I know the Blend is working because the camera view does swap to the new camera component when it should, it just doesn’t bloody move!
I know when this is figured out, it will be some check-box I ticked nonchalantly days ago without realising the effect it would have later! haha
Okay, I’ve been working on this tonight and got something interesting.
If I create a new projectile that has a Static Mesh as the projectile with everything else as it was, then this camera follow works. As soon as I deleted the Static Mesh and replaced it with a Destructible and then played, it did the same as before.
Somebody told me it should work with Destructible meshes so what do you think? Is there a setting in the Destructible mesh component that I need to have on/off to make it act the same as the Static Mesh component?
Ohh, I thought you’ve tried attaching camera to something else than a destructible. I’m surprised that collision and physics were working for you so far. Nevertheless it’s a bug and should be reported, if it’s not already.
As a workaround I would spawn destructible only on impact or pull it from the pool, if you are planning to have a lot of those.