YouGroove Posted March 9, 2013 Share Posted March 9, 2013 Well i use teh script free camera look. I would need to place in front of camera some object, does anyoen knows how ot program that ? because we have camera position and rotation already. Tried that : but it don't runs and says SetPosition is not good ? function Script:Render() self.entity:SetPosition(self.pivot:GetPosition(true),true) deltaPosx = self.pivot.x deltaPosy = self.pivot.y deltaPosz = self.pivot.z launcher:SetPosition(deltaPosx,deltaPosy,deltaPosz,true) end Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Andy Gilbert Posted March 9, 2013 Share Posted March 9, 2013 How have you referred launcher? As a guess you should be using self.launcher. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2013 Author Share Posted March 9, 2013 Nope weapons will have to be dynamic. The camera have "freelook" script, i just added weapons management in it for the moment. The launcher is loaded by code, and declared as globam variable. function Script:Start() launcher = Model:Load("Models/Characters/test/launcher.mdl") Then it is rotated as camera is rotated function Script:UpdatePhysics() ... ... camerarotation.x = camerarotation.x+self.mousespeed.y*self.lookspeed camerarotation.y = camerarotation.y+self.mousespeed.x*self.lookspeed self.entity:SetRotation(camerarotation) launcher:SetRotation(camerarotation) Finally i tried to move it in front of camera : but compilation fails function Script:Render() self.entity:SetPosition(self.pivot:GetPosition(true),true) deltaPosx = self.pivot.x deltaPosy = self.pivot.y deltaPosz = self.pivot.z launcher:SetPosition(deltaPosx,deltaPosx,deltaPosx ) end I guess, it's another maths that are needed to place some object in front of camera like using the normal vector of camera direction. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Andy Gilbert Posted March 9, 2013 Share Posted March 9, 2013 Well as you can see in my video I have an fps style gun attacted to the camera or self character. I didn't make this global as I have developed a weapon management for the main character only (yourself) so my weapons are completely self controlled. As in I have a script for each weapon as each weapon is different and has many different properties. And these are then attached to the relative weapon model that can be picked up by the main character. I didn't have to use any normals of the camera. Using parenting is the way I do it. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
YouGroove Posted March 9, 2013 Author Share Posted March 9, 2013 Thanks i'll try that way of parenting function. Do you have a character in FPS view ? abd attach weapons to it ? Quote Stop toying and make games 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.