tolga Posted April 27, 2023 Share Posted April 27, 2023 (edited) Hi, I'm working on a VR project where at some point we want to display a gas mask attached to the player's face. I first tried creating a scriptable material where I render a gas mask texture on the scene, but that looked weird. It didn't create a stereographic effect. Then, I tried placing a gas mask mesh in front of the player. There is a body mesh and the gas mask is attached to the body mesh. On update, I move the body mesh, therefore, the gas mask should move. But, even if I update the body mesh every frame, there is a delay in the gas mask, it looks like it does not look like it's attached to the player's face. How can I overcome this problem? Note: Forgot to mention, we are using the ComponentSystem. I update the transform on every COMPONENT_UPDATE(myUpdate). Thanks! Edited April 27, 2023 by tolga Link to comment
cash-metall Posted April 27, 2023 Share Posted April 27, 2023 Hello! maybe something with the update order, for example, the head is updated after the gas mask. try changing the code to COMPONENT_UPDATE(myUpdate, 255) or COMPONENT_POST_UPDATE(myUpdate) if this does not help, please attach a video with a problem (if possible) or a piece of implementation GasMask components (or at least myUpdate method) Link to comment
tolga Posted April 27, 2023 Author Share Posted April 27, 2023 Thanks for the answer. I moved myUpdate to COMPONENT_POST_UPDATE, it's a bit better, but still not perfect. Any way to make it better? Here's a video of the problem: Thanks! UNIGINE Engine Window 2023-04-27 12-09-00.mp4 Link to comment
christian.wolf2 Posted April 27, 2023 Share Posted April 27, 2023 Hi tolga, so you are my successor in this project?! :) Did you had a look in the ObjMovable component file? There are some code for head attachment, like head_pos and head_rot. This should be the way you go. You can also have a look in UNIGINEs Superposition demo project. They have an example component for an attachable hat, that can be picked up by the user and placed on top of it. Cheers Christian Link to comment
tolga Posted April 27, 2023 Author Share Posted April 27, 2023 5 hours ago, christian.wolf2 said: Hi tolga, so you are my successor in this project?! :) Did you had a look in the ObjMovable component file? There are some code for head attachment, like head_pos and head_rot. This should be the way you go. You can also have a look in UNIGINEs Superposition demo project. They have an example component for an attachable hat, that can be picked up by the user and placed on top of it. Cheers Christian Thanks for the tips man! It's fun working on your code anyway. I didn't have to do major changes :) Link to comment
tolga Posted May 4, 2023 Author Share Posted May 4, 2023 Hi Christian, I tried the Superposition with max settings and when you wear the hat, the exact same problem occurs :) It's fine in optimal or minimum settings, because the FPS is very good (90 FPS). I wonder if there is support for VR in scriptable materials, maybe like the ability to render half of a texture to left and the other half to right? Thanks. Link to comment
Recommended Posts