reepblue Posted June 25 Share Posted June 25 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...
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.