• [BUG?] cam.Start3D is acting weird. Sample code posted.
    4 replies, posted
[video=youtube;R1QW-6f9PdM]http://www.youtube.com/watch?v=R1QW-6f9PdM[/video] It changes it's position [B]slightly[/B] when the angle changes. If someone can help me, fix this issue, I'd appreciate it. Here is the exact code I'm using: [lua]local CSModel = ClientsideModel( "models/props_c17/FurnitureTable003a.mdl" ) CSModel:SetNoDraw( true ) CSModel:SetPos( vector_origin ) CSModel:SetAngles( angle_zero ) hook.Add( "PostDrawOpaqueRenderables", "Test", function( ) if !CSModel then return end local camAngle = EyeAngles( ) local camPos = ( EyePos( ) - LocalPlayer( ):GetPos( )) cam.Start3D( camPos, camAngle, LocalPlayer( ):GetFOV( ), 0, 0, ScrW( ), ScrH( )) cam.IgnoreZ( false ) CSModel:DrawModel( ) cam.IgnoreZ( false ) cam.End3D( ) end )[/lua]
You don't even need a 3D camera there, you are already drawing in a 3D context.
Funny as it is, I need it. Here is why: [t]https://dl.dropboxusercontent.com/u/17839069/C_123.png[/t] I scaled the car models down, the rendering stops (clips out a portion of it). I re-render the car with normal scale to keep the detail I'd be losing when I scale it down. Without my method looks like this: [t]https://dl.dropboxusercontent.com/u/17839069/C_124.png[/t]
Ok, I tested it, and you gotta do it like this: [code] cam.Start3D( camPos, camAngle )[/code] Also, those two cam.IgnoreZ should be removed as they don't do anything. At least with those arguments in that code. [editline]16th July 2014[/editline] It does it because of the 3rd argument, which you can set to nil to use whatever the engine default is.
[QUOTE=Robotboy655;45402502]Ok, I tested it, and you gotta do it like this: [code] cam.Start3D( camPos, camAngle )[/code] Also, those two cam.IgnoreZ should be removed as they don't do anything. At least with those arguments in that code. [editline]16th July 2014[/editline] It does it because of the 3rd argument, which you can set to nil to use whatever the engine default is.[/QUOTE] Thanks man, appreciate it. Worked for me.
Sorry, you need to Log In to post a reply to this thread.