Is there a way for a mesh to be selected by the player with a keybind toggle, and the camera snaps to centre the selected mesh?
I’m trying to figure out how to make a simple inspect mechanic for some meshes and any help would be appreciated.
Thanks
Is there a way for a mesh to be selected by the player with a keybind toggle, and the camera snaps to centre the selected mesh?
I’m trying to figure out how to make a simple inspect mechanic for some meshes and any help would be appreciated.
Thanks
You may need to provide more info. How would this work?
When you say snap, you want no animation? Snap to the centre of the mesh? Do we keep at the current distance or zoom in?
Consider fleshing out your question to get a better answer.
That’s fair enough I’m just worried about adding too much fluff
Ideally- The player enters a specified radius around the object, and is then allowed to interact (with a prompt) only when looking directly at the object.
When the player is Inside the radius, looking at the object, and pressing the prompted key- the camera should smoothly be forced towards the centre of the mesh.(no zoom). Mouse movement could be reduced and the camera will constantly be fighting back trying to look at the object.
Player movement doesn’t need to be stopped
The camera lock is turned off instantly by pressing the activate button again - or moving out from the object radius
Sorry for not giving enough detail before I’m still learning
that sounds ridiculous imo. you want the camera to smoothly move toward the mesh but at the same time you want the player to remain in control and be able to pull away from the mesh, while you can also just press a button to negate the whole process?
if it were just a inspect object kind of thing then i would say look into a view target blend which would handle the smooth transition from the player view to the item view. thats a pretty easy thing to do based on triggers or input. what your describing though makes no sense and is difficult to comprehend.
This will be a weird user experience in 1st person and may turn out to be quite annoying in 3rd person.
When you play as 1st person and wrestle camera controls from the player outside of a cutscene, you’ll lose the sense of being rooted in the character, which is the whole point of 1st person. May not work for everybody.
For 3rd person, the character would almost always be placed between the object and the camera. This means you need to push the camera through the player or move it close to the player’s body / head if it’s over the shoulder style cam. Or zigzag around the player’s mesh which is, arguably, quite strange.
This, of course, does not mean it’s not worth trying, and should not be too difficult to implement. Since it’s the player that chooses when to engage this inspect mode, it may not be that bad.
The objects have overlapping collision:
The script:
Feels quite sticky. With the mode engaged, if you move slowly, you will eventually end up strafing around the target
Experiment, tweak it, you might be up to something. Who knows!
Thank you so much c: This is all very helpful
I’ll start experimenting with this now
That instigator node looks dodgy. Instigator has something to do with damage dealing, no?
Also, make sure the casts at the top are not failing, or to be more precise - put a print string node after setting NearbyObject and print its name - just to make sure that thing are triggering.
edit: in case you can’t get it to work I uploaded the project here:
https://drive.google.com/open?id=1mikL9gModzZLG9dxkWulpV8vkI1W0KIB
Ok so after some time, I am struggling to get the script to work, after trying my best to replicate your work- the closest I can get is my camera twitching in random directions
I think I have some problem with the nearby object variable, but I can’t for the life of me figure out how to fix it
Ah now it’s working
Thankyou Everynone for taking the time to help me this is exactly what i needed
Just one last thing- is there any way for the object to be selected only if the player is looking at it (whilst still being in its radius)
Sorry I don’t mean to be a nuisance I’m very grateful for all the help
Just one last thing- is there any way
for the object to be selected only if
the player is looking at it (whilst
still being in its radius)
Yeah, should be doable with trace.
You could also use Get Actor Eyes View Point instead of Get Control Rotation. It will get the viewpoint of the actor specified. I was having issues using Get Control Rotation.