CAMERA POSITION ???????

hi ,
please PLEASE help me .
iam developing a cat and rat game.
i added a rat.3ds object to transform group (obj10) . its fine upto here. when my rat is moving forward i want to move the camere with my rat.
code is here
KeyBehavior keyBeh = new KeyBehavior( obj10);
keyBeh.setSchedulingBounds(new BoundingSphere(new Point3d(),1000.0));
obj10.addChild(keyBeh);
tg.addChild(obj10);
import java.awt.AWTEvent;
import java.awt.event.*;
import java.util.Enumeration;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.behaviors.vp.*;
public class KeyBehavior extends ViewPlatformBehavior
private static final double ROT_AMT = Math.PI / 36.0; // 5 degrees
private static final double MOVE_STEP = 0.2;
// hardwired movement vectors
private static final Vector3d FWD = new Vector3d(0,0,-MOVE_STEP);
private static final Vector3d BACK = new Vector3d(0,0,MOVE_STEP);
private static final Vector3d LEFT = new Vector3d(-MOVE_STEP,0,0);
private static final Vector3d RIGHT = new Vector3d(MOVE_STEP,0,0);
private static final Vector3d UP = new Vector3d(0,MOVE_STEP,0);
private static final Vector3d DOWN = new Vector3d(0,-MOVE_STEP,0);
// key names
private int forwardKey = KeyEvent.VK_UP;
private int backKey = KeyEvent.VK_DOWN;
private int leftKey = KeyEvent.VK_LEFT;
private int rightKey = KeyEvent.VK_RIGHT;
private WakeupCondition keyPress;
// for repeated calcs
private Transform3D t3d = new Transform3D();
private Transform3D toMove = new Transform3D();
private Transform3D toRot = new Transform3D();
private TransformGroup tg;
public KeyBehavior(TransformGroup tg)
this.tg = tg;
keyPress = new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED);
} // end of KeyBehavior()
public void initialize()
{  wakeupOn( keyPress );  }
public void processStimulus(Enumeration criteria)
// respond to a keypress
WakeupCriterion wakeup;
AWTEvent[] event;
while( criteria.hasMoreElements() ) {
wakeup = (WakeupCriterion) criteria.nextElement();
if( wakeup instanceof WakeupOnAWTEvent ) {
event = ((WakeupOnAWTEvent)wakeup).getAWTEvent();
for( int i = 0; i < event.length; i++ ) {
if( event.getID() == KeyEvent.KEY_PRESSED )
processKeyEvent((KeyEvent)event[i]);
wakeupOn( keyPress );
} // end of processStimulus()
private void processKeyEvent(KeyEvent eventKey)
int keyCode = eventKey.getKeyCode();
// if(eventKey.isAltDown()) // key + <alt>
// altMove(keyCode);
// else
standardMove(keyCode);
} // end of processKeyEvent()
private void standardMove(int keycode)
{ if(keycode == forwardKey)
doMove(FWD);
else if(keycode == backKey)
doMove(BACK);
else if(keycode == leftKey)
// rotateY(ROT_AMT);
doMove(LEFT);
else if(keycode == rightKey)
// rotateY(-ROT_AMT);
doMove(RIGHT);
// else if (keycode == fireKey)
} // end of standardMove()
/* private void altMove(int keycode)
// moves viewer up or down, left or right
{ if(keycode == forwardKey)
doMove(UP);
else if(keycode == backKey)
doMove(DOWN);
else if(keycode == leftKey)
rotateY(ROT_AMT);
else if(keycode == rightKey)
rotateY(-ROT_AMT);;
} // end of altMove()*/
private void rotateY(double radians)
// rotate about y-axis
{ tg.getTransform(t3d);  
toRot.rotY(radians);
t3d.mul(toRot);
tg.setTransform(t3d);
} // end of rotateY()
private void doMove(Vector3d theMove)
{ tg.getTransform(t3d);
toMove.setTranslation(theMove);
t3d.mul(toMove);
tg.setTransform(t3d);
} // end of doMove()
} // end of KeyBehavior class
PLEASE HELP ME.
THANKS
SATISH

What you should do here is put the geometry for the rate below the view platform in the scene graph. That way, when the view platform (and hence the camera) moves, the rat moves with it.
or vice versa.
put the view platform below the transform group containing the rat so that when the rat moves, so does the viewing platform.
checkout the setPlatformGeometry method of ViewingPlatform (from the j3d utils library) to get an idea of how others have done this.

Similar Messages

  • 3D camera position in rendered video different to camera position in timeline preview

    Hi all,
    I'm trying out the 3D and animation features of Photoshop for the first time. The model is a free 3DS model. Because After Effects doesn't support importing this format, I'm animating it in Photoshop against a 'green screen' that I will then chroma key out in After Effects.
    The problem is that the rendered video output's viewport / camera position doesn't match that in the timeline preview in Photoshop.
    In the screenshots below, I've overlaid the rendered video over the 3D workspace. In the first image, the video and timeline preview are identical. However, from the second image onwards, they diverge. (The semitransparent cow is the video overlay.)
    The first time I simply clicked on 'default camera' before rendering. The second time, I added a 3D camera position keyframe to the 3D layer and set it to the default camera. The result was the same both times.
    I would be grateful for any help with making the rendered video match the timeline preview.
    Thanks.

    This was resolved by chatting with Adobe Support.
    It turned out to be a problem with corrupted preference files in %appdata%\Roaming\Adobe\Adobe Photoshop CC .
    Moving this folder to the desktop solved the issue

  • Camera Position Icons Disappear after installing FCP on new iMac...

    Anybody have an idea? Just bought a new iMac with an Intel Core i7 processor and maxed out the RAM at 16 GB. Now, when launching Motion, the camera position icons in the top right corner of the viewer, and the camera view menu on the top left of the viewer have mostly disappeared - just leaving some weird colored blocks.
    Thanks!

    Update Motion to 4.0.3 - that was a bug that's been fixed...
    Patrick

  • Photoshop CS6 3D Return to Initial Camera Position

    I am using the 3D funtions of CS6 and I noticed a bunch of options either moved around or removed completely. Well, more likely is that I'm just not able to find them. Anyway, one of the funtions I have not yet been able to find is the "Return to Initial Camera Position" button. It used to appear in the control panel but not anymore. In order to get the object and camera back to their initial postion I could just go into the history panel and back up to when I first opened the object but that kind of defeats the purpose.
    Any sort of help would be greatly appreciated. Thanks.

    Click "Current View" in 3D panel, then in Properties panel, pick Default from the View menu.
    You can save views, too, and they'll appear in the 3D panel where a click will switch to the view.

  • How do you read the camera position in the 3d picture control?

    Hello,
    There is a method to setup the camera position, but how do you read the current camera position?  e.g. the user uses the mouse, ctrl, and shift, to change the camera position.  How do you read this new camera position?  There don't seem to be any properties to do this.
    I've read this thread:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=214629&requireLogin=False
    but the question was never answered....
    From the comments in that thread, even if you had the proper documentation for the "Model Matrix" property, you couldn't get the information necessary to calculation the camera position.

    Lorielle,
    Thanks for the VI.
    Could you point me towards a more detailed description of the "Modelview Matrix" property?  I've attached a screenshot from the online help.  It is not very helpful.
    Attachments:
    Modelview Matrix.jpg ‏71 KB
    Modelview Matrix1.jpg ‏71 KB

  • After effect camera position

    Hi, i've asked a question yesterday, about animating line, like f1 intro, Rick Gerard has tought me, (i want to thanks him, because that thread was closed or i donnt know what happened with it) how to do it, but i have a little problem, with the cameras.
    I cant make prespective view, the lines moves but nothin happen with the perspective.

    Make sure you have active camera selected in the Composition window, then animate the camera position. Make sure you set one keyframe to start.

  • Photoshop CC 3D - how do you move camera position?

    I'm in Photoshop CC 3D, and I have a simple scene with one complex object. I can't find any way to move the position of the camera beyond the default positions, like top, front, back. I can do it CS6, but I can't do it in CC. I can rotate the object, but I want to keep the object where it is. I want to move the camera.
    Any help gratefully received.

    Yes, thank you that works. It appeared to be constrained to 2 dimensional movements before, but now it works. It's very confusing having 3 dimensions to work in!
    Thank you for your clear and helpful answer.

  • Need to correct tilted camera position - Premiere CS4

    Hello there,
    Yesterday I filmed an event with a camera up high in a horizontal bar (on a gorilla pod - upside down).
    EDITING WITH  PREMIERE CS4
    I corrected the upside down position with a vertical and horizontal flip.
    But now I have problems with tilting. I tried to use the rotating tool to correct the problem, which worked for the tilting, but the movie frame is now tilted with black filling the rest of the screen. I figured I could use the crop tool to eliminate the black waste, but it only crops along the new tilting frame, which doesn't solve my problem.
    What I need is to have the rotation as it is, but crop along the original frame (unrotated). Do I make any sense?
    I attach two photos to help clarifying my question.
    ORIGINAL
    ROTATION
    Although it's not very apparent since the edges are mostly black, you can see from the projection screen that my frame is now tilted to the right. The rotation is correct, but I need to eliminate the upper, down, left and right edges to make all the frame uniform again.
    Any ideas?
    By the way... how can I correct barrel distortion?
    Thanks,
    Goncalo Figueiredo

    even if it was MORE off the horizon plane...it wouldnt bother me at all...
    all im saying is it doesnt bother me at all....and next time keep it in mind how to level the camera etc...or else make the whole thing smaller on your delivery and crop it, rotate it etc they way you want to correct...
    In other words, put your assets into a smaller project so the video is "bigger" than the project frame...now you can rotate etc and not run out of space...

  • Does a sports camera positioned beside the top right corner of iPhone4 cause interference to GPS?

    I rarely experience inaccurate tracking on Sports Tracker app though I did experience it the other day.
    Since buying my HRM2 (for iPhone 4) I no longer run the myriad other GPS tracking apps on my iPhone. However, while out on a ride I discovered ST was not tracking well, so decided to simultaneously run a couple of apps. Another also experienced tracking problems.
    I decided to remove the iPhone from the ST bike mount and put it in my back pack. The tracking issue resolved itself.
    I was operating a sports camera on my bike at the time. It was located right beside the top right corner of the iPhone. On another bike, the sports camera is positioned differently (forward and lower of the top left corner) and I have experienced no problems with tracking. Could it have been causing interference on this ride due to its position?

    My daughter has had her Razr for about 9 months now.  About two weeks ago she picked up her phone in the morning on her way to school when she noticed two cracks, both starting at the camera lens. One goes completely to the bottom and the other goes sharply to the side. She has never dropped it and me and my husband went over it with a fine tooth comb. We looked under a magnifying glass and could no find any reason for the glass to crack. Not one ding, scratch or bang. Our daughter really takes good care of her stuff, but we still wanted to make sure before we sent it in for repairs. Well we did and we got a reply from Motorola with a picture of the cracks saying this was customer abuse and that it is not covered under warranty. Even though they did not find any physical damage to back it up. Well I e-mailed them back and told them I did a little research and found pages of people having the same problems. Well I did not hear from them until I received a notice from Fed Ex that they were sending the phone back. NOT FIXED!!! I went to look up why and guess what there is no case open any more for the phone. It has been wiped clean. I put in the RMA # it comes back not found, I put in the ID #, the SN# and all comes back not found. Yet a day earlier all the info was there. I know there is a lot more people like me and all of you, but they just don't want to be bothered so they pay to have it fix, just to have it do it again. Unless they have found the problem and only fixing it on a customer pay only set up. I am furious and will not be recommending this phone to anyone. And to think I was considering this phone for my next up grade! NOT!!!!

  • 3D position using camera system - real time

    Greetings!
    I amtrying to use Labview to track an object in 3D space.  I am using threehigh speed cameras which are connected via a framegrabber to my PC.  Theidea is that I want to be able to throw an object, let’s say a ball, and haveLabview detect the motion and return real time stats on the object (location inxyz and the velocity vector).  The object should be about the size of abird as this will be the final object tracked.
    I amcurrently constrained as to where the cameras can be.  They have to bepositioned in a horizontal line beside one another, but they can be turned toany angle I see fit. 
    Ihave some ideas of how to approach this but since this is my first visualproject I am a little unsure what the best method will be.
    Oneidea I had was to have one camera centered facing strait forward and one cameraon either side if it turned 45 degrees toward the center line of vision. Thenthe idea would be to calculate the actual x-y-z position based on the geometryof the camera.  However this method isless than flexable.
    Anotheridea was to eliminate restrictions on the camera positions and have some sortof target system set up which would then "calibrate" the cameras foreach particular setup. I am thinkingof x and y rulers printed out and hung from the ceiling.  Then, using the distances between x ruler markingscompared to y ruler markings to determine the camera angle and what the zcomponent should be. Maybe use a basketball to calibrate instead?
    Solutions?Working code that takes jpegs from three saved camera files?  Any help atall in 3D positioning would be much appreciated. 
    Thanks inadvance!!
    ~Chad

    Chad,
    Having all three cameras in a straight line is a poor choice for 3D work.  Try putting one at (1,0,0), one at (0,1,0) and one at (0,0,1) or some similar distribution.  Then the angle from the camera axis gives you a starting point for your 3D geometry.
    Can you arrange that the object is always in the field of view of all three cameras?  Do the cameras/lenses distort off-axis images?
    If the object is a known size and has a simple geometric shape (sphere, cube, tetrahedron), you may be able to also use size of image to get an estimate of distance.  Rotation of more complex shapes makes for a difficult calculation.
    The rulers might be helpful if the object size is known.  If the object size is unknown or variable, the challenge is much greater.
    Lynn 

  • 3D Picture Control Orthographic View zoom - Camera Set up?

    I am trying to display two 3D picture controls.  One displays some objects in 3D (Auto Projection: Perspective, Camera Controller: Spherical).  This 3D image works great and I am having no problems with it.  The other Picture Contol is meant to simulate a 2D image of the 3D object, essentially a Plan View.  To do this I made a 3D picture control with a Orthographic view.  I set the camera to view from above (z-axis) and set the target to be positive y-axis. 
    I have attached an example vi (labview 2013 SP1) that creates some simple 3D objects and displays them in Perspective and Orthographic using the same Camera Position.  On initial start, the Orthographic image is zoomed in heavily. If I manually zoom it (Hold Shift button and mouse up or down), then the Orthographic image will set itself to the correct Camera position.  This is essentially the solution to my problem, but I can't assume the user will have the ability to manually zoom the image.  So I need to set it programmatically.
    If you manual adjust the view on either screen (rotate and zoom), then click the Set Camera button, both images will give a plan view, but only the Perspective Image will be at the correct camera zoom or distance.  The Orthographic stays at the last zoom distance.
    Is there any way to set the Camera distance for Orthographic projection programmatically?   I have tried starting with the 3D picture control as perspective, set the camera distance and then changing it to orthographic, but this still results in a zoomed orthographic image.  From the reading I have done, I think I am trying to the impossible.  Does any one have another suggestion to get the same result.  I have previously used the 2D picture functions to generate the image but found that method inefficient. 
    And suggestions would be great.
    Thanks
    Relec
    Attachments:
    3D_projection_Test.vi ‏38 KB

    Hi Relec,
    thank you (and Kudos) for that inspiring demo!
    Took me while to work it out, but I might have found something that could help us with the orthographic projection.
    Sometime back someone posted a way to collect the current Camera data. Sorry I lost the source. But here is my version as a Get3DCameraPosition.vi using the ModelViewMatrix.
    Unfortunatly this doesn't return the current Target and so a bit of guessing in the right Direction is necessary.
    I'm impressed you found a way to make the Shift-Drag Zoom-movement possible on the orthographic window.
    It seems a whole thread at http://forums.ni.com/t5/LabVIEW/3D-Picture-Control-Doesn-t-Zoom-in-Orthographic-Mode/td-p/1544460/page/2 wasn't able to find that out.
    In the meantime I've found a way using the ProjectionMatrix to create a zoom-effect which I build into your demo using the mouse wheel.
    All in all I've tried to translate camera movements from the perspective window in the ortho - assuming this is what you were after?!
    Again the missing target information doesn't make it quite right.
    Regs
      Jannis

  • Vanishing Point Exchange - How to place the camera ?

    When I import a .vpe file into AE, I'm given a "custom" camera with an un(real)worldly focal length, and six-figure position and zoom values. My 3D scene is in extreme close-up.
    My intuition is to give the camera a 35mm preset, set the zoom in real-world terms (I know,... I'm not in the real world anymore, Toto) and then move the camera position to my required start point.
    I've been trying this, with multiple variations, all day and am getting nowhere - whatever I do results in either correct geometry at an unusable distance, or a nicely composed frame with unacceptable geometry. (I got lucky once early this morning - but have since been unable to repeat the result).
    A question to those who, unlike me, know what they're doing: How should I go about this ??
    Thanks !

    That's
    brilliant - thank you so much. This points the camera squarely at the
    front vertical plane (in the real world terms of my scene, the end wall
    of the hall). I'm no longer lost in space.
    I then change the
    camera Position Z-axis value to bring the camera closer to this plane
    and ... Uh oh! the other four planes (side walls, floor and ceiling)
    become stretched into a streaky blur. Where did I go wrong ?
    If you want to post a screenshot, feel free to do it.
    I suspect what you are seeing is a limitation for textures extracted from planes which have wild perspective shifts. When planes are more perpendicular to the "real" camera, the less actual texture information in the original, especially as pixels go further away from the camera. Zooming/orbiting with a 3D camera just makes this much more obvious So, there are some real world limitations when navigating pictures turned into 3D scenes in this way.
    In clarification ... My final output is a QuickTime movie played from hard disk to a video projector. I work to a  frame size of 1400 x 1050 pixels to match the SXGA+ native resolution of my preferred projector (avoiding rescaling and loss of resolution in the projector). The size of my AE Footage image (in this case) is 5139 x 5433 to allow me to move my 1400 x 1050 frame around the footage to simulate camera movements. In the case of the "dolly in" towards the wall in my .vpe 3D set, 1400 x 1050 original pixels is the extreme limit of the movement beyond which I cannot go without interpolation and loss of resolution.
    So to rephrase my question, with apologies for lack of clarity first time around, what would be a realistic limit to the pixel count of my footage image given the limitations of my system: 2.26GHz Quad-Core, 16 GB RAM and fast RAID ?
    There should be no problems in such a case. In any case, just leave a couple of CPUs free in Memory and Multiprocessing, so that the other instances have more memory available to them.
    (I've just ordered CS4, even though CS3 is more than adequate to my "aesthetic" needs, as I believe it offers better management of multiprocessing – and in the hope it will make my OpenGL problems go away.)
    Multiprocessing in CS4 should be better, not worse. Sometimes "better" means taking a more conservative approach
    In CS3, MP was more an "all or nothing" kind of thing, even if people used a buried text preference to turn off some cores. There are now officially supported management options for users.

  • Camera Rotation Problem

    Hello
    I have a problem with my camera rotation. I would like to have a button which allows me to rotate a camera in my scene using only x and y axe and with z axe blocked. My javascript is :
    var c = getAnnots3D(0)[0].context3D;
    var camera = c.scene.cameras.getByIndex(0);
    var camdir = camera.position.subtract(camera.targetPosition);
    camera.position.set(-Math.sin(3.14/6)*camdir.y+Math.cos(3.14/6)*camdir.x,Math.cos(3.14/6) *camdir.y+Math.sin(3.14/6)*camdir.x,camdir.z);
    Script works good for x and y axe , but unfortunatelly z axe moves too(kind of a wave, starts low goes up and ends down after Pi/2) . Even if I block it using a constant instead of camdir.z, it moves but javascripy debugger shows z value blocked.
    Any idea what I'm doing wrong ?
    Help appreciated
    Bartek

    Your math really doesn't make any sense to me.
    All those math.cos(..) calls are constant because you are only passing constants. i.e. Math.cos(3.14/6) will always be 0.866158094. So you are doing this:
    position.set(-.9y + .5x, .9x + .5y, z);
    I'm not really sure what this "button" is supposed to do. if you want it to prevent the camera from tilting up and down, you have to repeatedly prevent the camera from tilting using a TimerEventHandler.
    Also, you are taking the camera direction and using it to set it's position, this will keep moving the camera near the origin and will probably be unpredictable.
    So really, I'm not sure what you are trying to do. Let the camera rotate freely in only 2 of it's own axis? only 2 of the world axis? or orbit an object only on 2 axis? only let it move left and right, but prevent it from tilting up or down? ...
    I can help, but you need to be more specific.

  • BIG PROBLEM: Can get camera but can't use it at all

    Hi all,
    I develop a broadcast app that uses the camera to broadcast video with netstream.
    I debug the code on Samsung GT-i9000, Android version 4.0.1, Baseband version i9000XXJVK, KErnel version 2.6.35.15-gcc86ee2.
    The trace shows the camera [object Camera], but when i attch the camera to the video object i see nothing i broadcast nothing!
    On other Android mobiles(older versions) it works fine.
    I use the adobe air 3 sdk.
    Any clue??

    I traced the camera:
    Chat, camera:[object Camera]
    Chat, camera index:0
    Chat, camera position:back
    Chat, camera width:720
    Chat, camera height:432
    Chat, camera muted:false
    So it apears that Adobe gets the camera, what goes wrong when attaching it to the video object? on the netstream object?
    One more thing. I downloaded UStream mobile application and also could not use camera.
    I'm sure it is something related to the OS

  • Rotate camera function

    Hello,
    I'm starting to write a code for Acrobat and 3d Objects.
    What I need is a function that rotates an object given a yaw and a pitch (i.e. rotateObjectYaw(45) to rotate the object 45 degrees around, rotating the camera, not the object itself).
    I started modifying the CameraRotate.js and I already made it work eliminating the friction effect and performing the full delta change in one iteration.
    Yaw works perfectly, but the problem is the pitch. If I rotate the Yaw first, the pitch does not rotate around the changed axis but on the original pitch axis. I guess the problem lies somewhere around:
            // Update camera direction
            var x = Math.sin( yaw   ) * Math.cos( pitch );
            var y = Math.cos( yaw   ) * Math.cos( pitch );
            var z = Math.sin( pitch );
            cameraDirection.set( x, y, z );
            // Update camera position
            trueCameraPos.set(targetPosition);
            trueCameraPos.addScaledInPlace(cameraDirection, cameraDistance * GlobalZoomScale);
            camera.up.set(targetPosition.x, targetPosition.y, targetPosition.z + cameraDistance);
            camera.position.set(trueCameraPos);
            camera.targetPosition.set(targetPosition);
    But I'm not sure, and I have no idea about vector space calculations and so. Can somebody help me out?

    Mike,
    Can you put this in the Rich Media & 3D forum: http://forums.adobe.com/community/acrobat/acrobat_3d_features

Maybe you are looking for

  • How to Install Windows 7 using BootCamp?

    I get this error message when i try to partition hard drive for windows 7. the disk cannot be formatted because some files cannot be moved. Back up the disk and use Disk Utility to format it as a single Mac OS Extended (Journaled) volume. Restore you

  • Test System (BQ1) Objects showing up wrong Source System after Transport.

    Hi Experts, We are working on IS-U BI7.0 Project. We have finished with our Development and have transported the DataSources, Transformations and DTPs from Development (BD1) into Test (BQ1) Systems. We have entered values in the Conversion of Logical

  • Can CRM Load to Two BW Systems?

    Veterans, Can an existing CRM Source system viably concurrently load into multiple BW (NW04s) Target productive systems? If it can, what precautions are needed to ensure viability of delta loads? I've reviewed landscape Note 775568 and it's caveats a

  • I cannot connect to belkin 54G wirless router with mac book but can ipod T

    as it say on the tin i cannot connect a mac book to belkin wireless router but can with my ipod touch, I get a generic error message. Any clues guys.

  • Can't see QT movies in Safari!

    Hi, I have the latest QT installed on my PowerBook. I keep getting a large question mark displayed everywhere a QT movie is supposed to play. Any advise? Thanks, Ido.