eugene.litvinov Posted February 21, 2011 Share Posted February 21, 2011 We use PlayerActor class, and we need detect camera position and direction. We use next code: actor.renderVisualizer(); vec3 p0 = actor.getPosition() + vec3(0, 0, actor.getCollisionHeight()); vec3 p1 = actor.getViewDirection(); vec3 p2 = p0 + p1 * 1.6f; engine.visualizer.renderDirection(actor.getPosition(), actor.getViewDirection(), vec4(1, 1, 1, 1)); engine.visualizer.renderLine3D(p0, p2, vec4(0.5, 1, 1, 1)); and see next screen: I need draw line via center of camera view, how to determine offset between collision capsule and player's camera? Link to comment
eugene.litvinov Posted March 7, 2011 Author Share Posted March 7, 2011 This offset is 0.3f in y axis :) Link to comment
eugene.litvinov Posted March 9, 2011 Author Share Posted March 9, 2011 In screenshot I blend together 3 camera positions: player looks up, center and down. In all states you can see blue lines, in center look this line pass directly through camera, but in up/down states this blue line shifts... I can not determine camera offset to locate this blue line directly on camera center. I try next: mat4 offset = actor.getOffset(); engine.visualizer.renderSphere(translate(actor.getPosition()) * offset, 0.4, vec4(1, 0, 1, 1)); But this sphere appear in bottom of player's collision capsule, not in camera position. How it can be possible to determine player's camera position? Thanks. Link to comment
eugene.litvinov Posted March 14, 2011 Author Share Posted March 14, 2011 This offset is 0.3f in y axis :) This offset is my fault... To get PlayerActor's camera transform we can use PlayerActor::getIModelview() method Link to comment
Recommended Posts