reepblue Posted June 25, 2024 Share Posted June 25, 2024 This is in the XFORM project currently. If you use multiple cameras for rendering and load in a map with post effects, this will be the result. This is how I'm creating the camera. void FPSWeapon::AttachToPlayer(std::shared_ptr<Component> playercomponent) { // Set up the camera for the viewmodel. Start(); auto entity = GetEntity(); auto world = entity->GetWorld(); auto player = playercomponent->As<FirstPersonControls>(); if (player) { auto playercam = player->GetCamera(); if (playercam != NULL) { if (drawonlayer) { viewmodelcam = CreateCamera(world); viewmodelcam->SetClearColor(0, 0, 0, 0); viewmodelcam->SetClearMode(CLEAR_DEPTH); viewmodelcam->SetMatrix(playercam->GetMatrix(true), true); viewmodelcam->SetFov(viewmodelfov); viewmodelcam->SetRange(0.001f, playercam->GetRange().y); viewmodelcam->SetOrder(RENDERLAYER_VIEWMODEL); viewmodelcam->SetRenderLayers(RENDERLAYER_VIEWMODEL); viewmodelcam->SetParent(playercam); entity->SetParent(viewmodelcam); entity->SetRenderLayers(RENDERLAYER_VIEWMODEL); viewmodel.lock()->SetRenderLayers(RENDERLAYER_VIEWMODEL); } else { playercam->SetRange(0.001f, playercam->GetRange().y); entity->SetParent(playercam); } } playerentity = player->GetEntity(); } } Full code here: XFORM/Source/Components/Weapons/FPSWeapon.cpp at main · UltraEngine/XFORM (github.com) Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted February 18 Share Posted February 18 Is this still happening? Is there any example I can run that will produce the error? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution reepblue Posted February 20 Author Solution Share Posted February 20 Not sure. We decided rendering a viewmodel to a different camera was not preferred and I forgot about this bug ever since. I would need to write a new example to test this. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.