Showing a blueprint (model) at spawn position before spawning it

Hey guys,

i can’t solve this question by myself.

At them moment i spawn actors by pressing ‘g’ at point i’m looking at.
I want to accomplish that you can see the model at the place before you spawn it.
Like placing a building in a strategy game. You see the building/model before placing it, so you can see where it would be if you press the mouse button.

I want the same thing but i don’t know how i get a moveable copy of my blueprint/model in realtime.

I can get the point im looking at through a tick combined with the line trace at real time, but i don’t know what i could use to show the player the model. Spawning it would be nonsense, since it would place one copy every tick instead of just showing it.

Do you have an idea? I can’t find a similar question here or at google ):

Thanks for the answers!

Ok ok wait a sec :smiley:

I have not worked with lifespan and timers until now.
Could you go into detail on this?

You mean i should spawn the placeholder model every 1 sec or so and set the lifespan of the model to 1 sec too. And if i place the model (or better if i dont have a placeable item in my hands) the timer which places this placeholder model gets killed?

Than i need to work my way into the timer, cause i don’t really no how they work (: But thanks for the answer.

Have you tried using the same model but changing its mesh so it becomes around 65% transparent and also make it greenish as-well? OR

You could go about creating a simple function which I think would be the easiest solution and that’s being called by a Timer so you’re not overloading yourself massive model spawn. In that function calculate where the players looking and place a transparent model of it there and set the life span to the same amount as the timer you have running for calling it. Once you press the ‘g’ key simply kill the timer and place the actual model.

I’d set the spawn rate of the model to every 0.1 seconds and set the lifespan of the model also to 0.1 seconds that way it’ll be spawning and than destroying the model every call.

Is it ok to call it per event tick or how could i do this.

Also im getting a weird error “Error Accessed None ‘CallFunc_Array_Get_Item’ from node Hunger System in blueprint BP_Character”

That didnt appear a second ago ): Guess i have to open a seperate thread to question that error -_-

It had nothing to do with the actual function.
It was something in the eventgraph. A combination of tick, sequenz and branch together with an array. Don’t ask me what that was :smiley:
I still dont know how i should call the timer.

I’m assuming that error is that it manage to access a null from the array and didn’t work.

Ok, did it with a timer that is set to 0.1 and called by the Event Begin Play. Also set the life span to 0.1
Thanks to S0T0!

Ok sorry, for reopening it, but i seems to not be the best idea to solve this.
Cause if creates way to many actors and tracking overlapping is also impossible cause the 0.1 old last actor overlaps with the new one.

Does someone has another idea?

Now i spawned the item and saved the object. In front of the spawn note a made a valid node to check if there is something in the object variable. If yes, i only update the location to the point im looking at. If not, it spawns the object and saves it again.
When i drop the object, the variable is cleared.

Thats one way, but the model isnt following the mousemovement fluent enough to say its the best option to solve this.
Some an idea?

I would suggest that as part of the player blueprint you have a scenecomponent with a mesh as a child of it, when you are not trying to place something, set the scene component’s visibility to false (with propagate to children true), and when you are placing something, every tick tell the scenecomponent to be visible true and set it’s location to wherever you want :slight_smile:

Or you could just change which mesh the component is?

Hm, it’s about a handfull of different things i want to place. Everything with it’s own mesh. So i would need to setup all meshes as childs and decide which one to show on which item the player wants to place. That sounds like a lot of work :confused:

Ok, i could set the mesh of the item i hold to the one my player has attached. But does the model lag when moving? Cause if i set the location of the model i spawn and use for the preview, it lags if i move it too fast.
I will give it a try later the day and tell you (: Thanks for the idea mate!

You’re welcome :slight_smile:

(I use this system myself) It shouldn’t lag :slight_smile: