Announcement

Collapse
No announcement yet.

Scene Capture 2D - Attach to Weapon

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scene Capture 2D - Attach to Weapon

    I am trying to make a 3D scope. My plan is to attach a camera to the front of the scope then render it to a texture that is on the visible part of the scope (to simulate the optics). So far I have been successful in making a SceneCapture2DComponent and having it render to the texture.

    However, my problem is that I have been unable to attach the SceneCapture2DComponent to the weapon. When I switch to the weapon the camera is activated but it stays in the place where i was standing. I've tried several things but they haven't worked (so I deleted that part of the code).

    This is my code in the weapon attachment class:
    Code:
    class SWAttachment_SniperRifle extends UTAttachment_LinkGun;
    var SceneCapture2DComponent CamZOOM;
    
    simulated function PostBeginPlay()
    {
    }
    
    DefaultProperties
    {
    	begin Object class=SceneCapture2DComponent name=SceneCapture2DComponent0
    		TextureTarget=TextureRenderTarget2D'SW_WP_E-11.Materials.M_E-11Render';
    		FarPlane=0;
    		bEnabled=true;
    	End Object
    	CamZOOM=SceneCapture2DComponent0
    	Components.add(SceneCapture2DComponent0)
    ...
    }
    Image example of what I want to do:
    1 is where the 1st person camera would go
    2 (the green/yellow texture) is where 3's camera image is rendered to
    3 is where a camera is placed facing forward

    #2
    I've been working on it more the past few days and I have still been unsuccessful in attaching the Scene Capture to the weapon. Here are two examples of what I have tried:

    Code:
    class SWAttachment_SniperRifle extends UTAttachment_LinkGun;
    var SceneCapture2DComponent CamZOOM;
    
    simulated function PostBeginPlay()
    {
    	Mesh.AttachComponentToSocket(CamZOOM, 'MuzzleFlashSocket');
    	CamZOOM.SetEnabled(true);
    }
    
    DefaultProperties
    {
    	begin Object class=SceneCapture2DComponent name=SceneCapture2DComponent0
    		TextureTarget=TextureRenderTarget2D'SW_WP_E-11.Materials.M_E-11Render';
    		FarPlane=0;
    		bEnabled=true;
    	End Object
    	CamZOOM=SceneCapture2DComponent0
    ...
    }
    Code:
    class SWAttachment_SniperRifle extends UTAttachment_LinkGun;
    var SceneCapture2DComponent CamZOOM;
    
    simulated function PostBeginPlay()
    {
    	Mesh.AttachComponent(CamZOOM, self.BaseBoneName,,,);
    	CamZOOM.SetEnabled(true);
    }
    
    DefaultProperties
    {
    	begin Object class=SceneCapture2DComponent name=SceneCapture2DComponent0
    		TextureTarget=TextureRenderTarget2D'SW_WP_E-11.Materials.M_E-11Render';
    		FarPlane=0;
    		bEnabled=true;
    	End Object
    	CamZOOM=SceneCapture2DComponent0
    ...
    }
    I've been trying to get this to work for a month and I've exhausted every option I can think of. Help would be appreciated!

    Comment


      #3
      I've been trying to get this to work for a month and I've exhausted every option I can think of. Help would be appreciated!
      When you have spent a month trying to get a cosmetic feature to work, then you should learn when to move on... Really.

      Comment


        #4
        Might not be cosmetic - 3d scopes are in quite a few games instead of doing a full screen scope affect (Red Orchestra for instance).

        That being said, I've got nothing.
        I believe this issue was touched upon before.
        Search for 3d scope perhaps?

        Comment


          #5
          This Tut will help: http://jvultimate.com/OldSite2/Creat...niperScope.htm

          Comment

          Working...
          X