simple casting/referencing problem

I’d like an object to follow my mouse cursor but am not able to get a reference to it without it already being in the level somewhere.
I can spawn it somewhere in the level, get all actors from class and then it works,
but I do not know how to achieve the same with a cast because I do not know what to connect to object.
(the blueprint from screenshot is playercontroller)

On the Get Hit Result node… Hit Result Hit Actor should be the one youre after, that goes to object on the cast then As Cube Actor goes to Target on the Set Transform.

You may want to check to see if your Get Hit Result is actually hitting something with that bool. If its not hitting anything then ofcoarse it wont return any Actor, cast or not.

You’ll want to use a reference to a Class and Spawn that, that will give you an Actor reference you can then plugin to your Set Location.

123651-spawn.jpg

Thanks for your response. If I do that, then there are no results (print string = empty and no object following mouse)

But it should not depend on it hitting something or not. All I need is an object following the mouse :wink:

I’d prefer doing it like this if I could only populate that default value.

Thanks! That works :slight_smile: It still feels kinda hackish, but a lot less then before.

Well you got it going thats the main thing and youre learning, you’ll work out how to do things better as you go along. You may want to mark this as resolved now :slight_smile:

Agreed! Thanks again for your help :slight_smile: