Collision prevension using picking

Hi everybody:
i am working on a java 3d game demo which uses picking as the collision avoidance utility.the code below is quite simple but in fact it cant pick anything. the problem has made me crazy for quite a long time and i still not find out the correction answer.if anyone could solve this problem ,i will be very thankful~ :)
public class TestBound extends Applet {
BranchGroup root;
public void createBranchGraph() {
root = new BranchGroup();
TransformGroup rootTG = new TransformGroup();
rootTG.addChild(new ColorCube(0.4));
root.addChild(rootTG);
//root.setPickable(true);
//root.setCapability(Node.ALLOW_BOUNDS_READ);
//root.setCapability(Node.ENABLE_PICK_REPORTING);
root.compile();
public TestBound() {
setLayout(new BorderLayout());
Canvas3D canvas = new
Canvas3D(SimpleUniverse.getPreferredConfiguration());
add("Center",canvas);
createBranchGraph();
SimpleUniverse su = new SimpleUniverse(canvas);
su.getViewingPlatform().setNominalViewingTransform();
su.addBranchGraph(root);
//System.out.println(new BoundingBoxGenerator(scene).getBounds());
public static void main (String[] args) {
TestBound tb = new TestBound();
new JMainFrame (tb,256,256).setVisible(true);
PickTool tool = new PickTool(tb.root);
tool.setShapeRay(new Point3d(1000,0,0),new Vector3d(-1,0,0));
System.out.println(tool.pickAny() == null);
the picking ray should intersect with the color cube,but in fact it cant pick anything and returns null always.

When you post code, please use[code] and [/code] tags as described in Formatting Help on the message entry page. It makes it much easier to read.

Similar Messages

  • Packing status becomes complete after using Pick HU

    Hi Experts,
    We use Pick HU for Outbound to pick products from warehouse to packing work center
    but as soon as we use pick hu in warehouse order for Out delivery and confirm the WO to pack center
    the status of packing becomes complete
    which should be ideally complete after we repack the products in to ship hu
    is there any thing i m missing to accomplish this?
    Regards,
    Roopendra

    Hi  Roopendra
    I hope this is Correct as its belong to task and not activity.
    And if you see activity OB02 then its has to complete at work center. This is about task.
    Pack status on del for picking and not for packing activity.
    Regards
    Suraj

  • How to use Pick Release Rule  while doing pick relase from API.

    Hi All,
    I need to Pick Release the Order based on pick release rule through and API. I am using WSH_DELIVERY_PUB to do Pick release/confirm.
    I did not find any parameter in the API which allows to use Picking rules for Pick Release.
    Is there any way we can do the PICK RELEASE using Picking Rule through APIs.
    Any information on this will be appreciated.
    Thanks
    Sreenivasa Gurani.

    Hi Srini,
    You need to use WSH_PICK_LIST.RELEASE_BATCH API, this one has two parameters
    1. p_batch_id -- Get it from WSH_DELIVERY_DETAILS tables
    2. p_log_level -- Not requires
    Or
    By Using this API you create the Batch
    WSH_PICKING_BATCHES_PUB.CREATE_BATCH -- This API Returns Batch id
    use this batch_id for WSH_PICK_LIST.RELEASE_BATCH
    Thanks
    Reddy

  • Stock transfer using PICK LIST / PULL LIST

    Hi Friend,
    We have two storage locations in the plant say 1000 - Main store which is ware house managed and 2000 - Production storage location.
    The goods issue needs to be done from production storage location 2000. How to transfer the material from 1000 - Main store which is ware house managed to 2000 - Production storage location using PICK LIST / PULL LIST concept.
    Kindly give the solution.
    Regards,
    Narendra Bora

    Hello Madhu,
    If you can suggest me as well. I am moving the goods to production storage location from raw material storage lcoation,
    While executing the MF60 it creates the reservation and display log
    RMPU     stock transfer reservations 00000412 22.03.2010 created successfully
    But does not move the goods using 311 movement type and stock is still in the raw material storage location.
    2ndly in MMBE, if i found the stock in Produciton location, it shows me
    Reserved                     20.000
    GR blocked stock         20.000
    Rcpt reservation          20.000
    If you can enlighten me in this area please, Would it move the stock or I need to make some other  steps also.
    Regards,
    JPS

  • Line details sort order when using Pick and Pack

    Hi,
    A customer of mine recently complained (very small complain) that when he used "Per date" as a sort when using Pick & Pack, that the line details where not grouped together by Sales Order Number.
    Example:
    2008/11/23   SO1001 - Line 1
    2008/11/23   SO1013 - Line 3
    2008/11/23   SO1001 - Line 2
    2008/11/23   SO1001 - Line 4
    2008/11/23   SO1021 - Line 1
    2008/11/23   SO1001 - Line 5
    etc...
    Is there a way to sort records on two columns instead of just one? or would there be another workaround this issue?
    Thanks
    Charles

    I think I found my answer, sorting data using the Data/Sort feature allows for sorting on multiple columns.

  • Stock Removal using Pick Point

    Hi all,
    I have configure Storage Type 100 with SU managed and a pick point ST 001.
    Once the TO is generated from delivery, the TO information will be from source ST100 to destination ST916.
    So I would like to know, how to identify the SU is arrived pick point? If there any status or information can help me to know the status of TO.
    Since i need to identify,
    1.SU still in the Source Storage Type (TO open)
    2.Worker starts transfer to SU to pick point with liftfork
    3.SU arrived Pick point
    4.Picker picked the material from pick point (TO picked)
    5.Picker transferred the material to GI area (TO transferred and completed)
    I dun know how to let user know the status of 2 and 3
    Thanks in advance.
    David Tai

    Hi David,
    If the pick point / ID point is defined for SType 100 then during transfer order creation system will automatically stamps the destination storage type as Pick point when it is taking out the stock from Stype  100
    I have simulated one scenario where for my storage type 010 the ID point / Pick Point is defined as 011
    Stock removal / putaway defined in material master & Stock in Storage bin are as below
    & the Putaway / Picking storage type search is defined as
    Now for the Transfer order creation i am using the T-Code  LT09 (enter the SU number & MvT and system automatically propose 011 as destination storage type in the transfer order
    Upon confirmation of the transfer order 0168, use LT09 again to transfer the SU from Pick point to final destination bin and system automatically propose 010 as the final destination storage type
    Hope this helps

  • Why the picking doesn't work

    Hi everybody:
    i am working on a java 3d demo which uses picking as the collision avoidance utility.the code below is quite simple but in fact it cant pick anything. the problem has made me crazy for quite a long time and i still not find out the correction answer.if anyone could solve this problem ,i will be very thankful~ :)
    public class TestBound extends Applet {
    BranchGroup root;
    public void createBranchGraph() {
    root = new BranchGroup();
    TransformGroup rootTG = new TransformGroup();
    rootTG.addChild(new ColorCube(0.4));
    root.addChild(rootTG);
    //root.setPickable(true);
    //root.setCapability(Node.ALLOW_BOUNDS_READ);
    //root.setCapability(Node.ENABLE_PICK_REPORTING);
    root.compile();
    public TestBound() {
    setLayout(new BorderLayout());
    Canvas3D canvas = new
    Canvas3D(SimpleUniverse.getPreferredConfiguration());
    add("Center",canvas);
    createBranchGraph();
    SimpleUniverse su = new SimpleUniverse(canvas);
    su.getViewingPlatform().setNominalViewingTransform();
    su.addBranchGraph(root);
    //System.out.println(new BoundingBoxGenerator(scene).getBounds());
    public static void main (String[] args) {
    TestBound tb = new TestBound();
    new JMainFrame (tb,256,256).setVisible(true);
    PickTool tool = new PickTool(tb.root);
    tool.setShapeRay(new Point3d(1000,0,0),new Vector3d(-1,0,0));
    System.out.println(tool.pickAny() == null);
    the picking ray should intersect with the color cube,but in fact it cant pick anything and returns null always.

    Have you tried reducing the distance to the point3d in your picktool - it looks like it is outside of the bounds for the cube. Have you looked at the picking demos that you downloaded with the j3d distribution? They are often a good starting point for picking up this kind of technique.

  • Is this a documented Collision Avoidance method???

    I keep the avatar in my app above the terrain by checking the x and z location every frame and then positioning it at the appropriate y point (i.e. the height of the terrain at point y) - I've seen methods of collision avoidance implemented before using picking, it seemed fairly complex. I want mine as simple as possible so I plan to do it like this:
    - Add the objects to the terrain so the avatar would go over them regardless of their height
    - At every frame, store the current x,y and z co ordinates
    - Then calculate the hieght of what the new x, y and z coordinates will be
    - If the the new y coordinate has too greater difference between that and the old one (relative to the differences betweeen the x and y as this will reflect the speed) then keep the avatar in the position of the old x, y and z.
    The value that represents the difference between the old y and new y cordinates would in effect be how steep the avatar can climb.
    Is this a documented mothod of collision avoidance?
    How good is this, speed wise, compared to other methods - I favour speed over accuracy.
    Thanks.

    I think it is quite a standard technique - the only
    danger is that if you are moving fast with a low frame
    rate you may jump up vertical faces like this:B            B
    |              /
    |             /   
    A   |         A  /
    -------         ---If you only have a frame drawn at A and B you would
    find no difference between those two examples, whereas
    from a gameplay point of view you may want there to be
    one.Hmmm, yes this thought had crossed my mind. Anyways, I'll give it a go and see how it works :)

  • Bouncing balls collision

    I am creating a program that has two balls which produce a sound when bouncing off the walls and each other. I am having trouble when they collide with each other, as my value for when they hit each other does not seem to be working. Here is my source code :
    import java.applet.Applet;
    import java.awt.Graphics;
    import java.awt.*;
    import java.applet.AudioClip;
    import java.awt.event. *;
    public class BallBouncing extends Applet implements Runnable {
            int x_pos = 20;
            int y_pos = 100;
            int x_speed = 1;
            int y_speed = 1;
            int x1_pos = 70;
            int y1_pos = 130;
            int x1_speed = 1;
            int y1_speed = 1;
            int appletsize_x = 300;
            int appletsize_y = 200;
            int radius = 20;
            int pos = (x_pos - x1_pos)*(x_pos - x1_pos) + (y_pos - y1_pos)*(y_pos - y1_pos);
            double pos1 = Math.sqrt(pos);       
            public AudioClip sound1, sound2;       
            Thread t;
            Button b1 = new Button("Reverse Direction");
            public void init() {
                b1.addActionListener(new B1());           
                add(b1);
            class B1 implements ActionListener {
            public void actionPerformed(ActionEvent e) {
            x_speed = +3;
            y_speed = -3;
            public void start() {
                            t = new Thread(this);
                            t.start();
            public void stop() {
            public void paint(Graphics g) {
                    g.setColor (Color.blue);
                    g.fillOval(x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
                    g.fillOval(x1_pos - radius, y1_pos - radius, 2 * radius, 2 * radius);
            public void run() {
                    sound1 = getAudioClip( getDocumentBase(), "Audio1.au" );
                    sound2 = getAudioClip( getDocumentBase(), "Audio2.au" );
                    while (true) {
                        try {
                            Thread.sleep(20);
                        } catch (InterruptedException e) {}
                        if (x_pos > appletsize_x - radius)
                            x_speed = -3;
                            sound2.play();
                        else if (x_pos < radius)
                            x_speed = +3;
                            sound2.play();
                        else if (y_pos > appletsize_y - radius)
                            y_speed = -3;
                            sound2.play();
                        else if (y_pos < radius)
                            y_speed = +3;
                            sound2.play();
                        else if (x1_pos > appletsize_x - radius)
                            x1_speed = -3;
                            sound2.play();
                        else if (x1_pos < radius)
                            x1_speed = +3;
                            sound2.play();
                        else if (y1_pos > appletsize_y - radius)
                            y1_speed = -3;
                            sound2.play();
                        else if (y1_pos < radius)
                            y1_speed = +3;
                            sound2.play();
                        else if (pos1 < 40)
                            x_speed = -3;
                            x1_speed = +3;
                            y_speed = -3;
                            y1_speed = +3;
                            sound1.play();
                            x_pos += x_speed;
                            y_pos += y_speed;
                            x1_pos += x1_speed;
                            y1_pos += y1_speed;
                            repaint();
    }Any help would be appreciated, thanks.

    Hi, here is a solution to your problem I hope. I have also included some extra features and brought your code up to a higher standard in terms of java conventions (however the {} on the next line is my convention, from C# :p).
    A few things:
    - For the balls deflecting at the proper angles then you will need to learn vector maths and I am afraid that my knowledge of that is rather sketchy (still 1st year uni student, more on that next year :p)
    - I used Graphics2D purely because I was lazy so I could write g2.draw(bounds); instead of using g.drawRect(x, y, height, width); - both methods give the same result
    - You will need to look up how to do drawing in applets to remove that flickering, I'm not sure if you do the same thing as normal swing/awt components (ie double buffering), as applets aren't my strong point.
    - I removed the button because it was unneccessary, it will take you 60 seconds to add it back in if you want.
    - You really REALLY should write a 'Ball' class and make some Ball objects instead of having separate variables for each ball. I will leave that up to you :)
    - I STRONGLY recommend the use of comments throughout any program you use, not because of convention but because it not only helps other developers to understand your code and what it does, but also to refresh your memory when you come back from a break and try to keep writing. (trust me, do not underestimate the power of comments!) . I have put a few in to show you what they should look like; they should be brief and concise, explain what a section of code does, and how it does it.
    - Enjoy!
    package sunforum_bounceball;
    import java.applet.*;
    import java.awt.*;
    public class BallBouncing extends Applet implements Runnable
         private static final long serialVersionUID = 1L;
         // ball 1
         private int x1_pos;
         private int y1_pos;
         private int x1_speed;
         private int y1_speed;
         private int b1_radius;
         // ball 2
         private int x2_pos;
         private int y2_pos;
         private int x2_speed;
         private int y2_speed;
         private int b2_radius;
         // other variables
         private Rectangle bounds;
         private Dimension appletSize;
         private boolean hasCollision;
         private boolean debugCollisionTesting;
         private AudioClip sound1, sound2;       
         private Thread t;
         public BallBouncing()
              // ball 1
              x1_pos = 100;
              y1_pos = 109;
              x1_speed = 2;
              y1_speed = 1;
              b1_radius = 40;
              // ball 2
              x2_pos = 100;
              y2_pos = 237;
              x2_speed = 1;
              y2_speed = 1;
              b2_radius = 20;
              hasCollision = false;
              // This is just for your help; turn this on to disable the balls changing direction when they collide.
              // This will enable you to check that when the balls are touching, we are detecting it.
              debugCollisionTesting = false;
              // Variables for the size of the applet and the bounding rectangle for the balls.
              appletSize = new Dimension(400, 400);
              bounds = new Rectangle(0, 0, 400, 400);
         public void start()
              t = new Thread(this);
              t.start();
         public void stop()
         public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              if (hasCollision)
              { g2.setColor(Color.RED); }
              else
              { g2.setColor(Color.BLUE); }
              g2.fillOval(x1_pos - b1_radius, y1_pos - b1_radius, 2 * b1_radius, 2 * b1_radius);
              g2.fillOval(x2_pos - b2_radius, y2_pos - b2_radius, 2 * b2_radius, 2 * b2_radius);
              g2.setColor(Color.BLACK);
              g2.draw(bounds);
         public void run()
              // +1 just so we can see the border of the collision area. Try taking out the +1's and see what happens.
              this.setSize(appletSize.width + 1, appletSize.height + 1);
              sound1 = getAudioClip( getDocumentBase(), "Audio1.au" );
              sound2 = getAudioClip( getDocumentBase(), "Audio2.au" );
              // Used to hold the distance between the balls.
              double p;
              while (true)
                   try
                   { Thread.sleep(20); }
                   catch (InterruptedException e)
                   // ball 1 x coordinate.
                   if (x1_pos > (bounds.x + bounds.width) - b1_radius || x1_pos < bounds.x + b1_radius)
                        x1_speed *= -1;
                        sound2.play();
                   // ball 1 y coordinate.
                   else if (y1_pos > (bounds.y + bounds.height) - b1_radius || y1_pos < bounds.y + b1_radius)
                        y1_speed *= -1;
                        sound2.play();
                   // ball 2 x coordinate.
                   if (x2_pos > (bounds.x + bounds.width) - b2_radius || x2_pos < bounds.x + b2_radius)
                        x2_speed *= -1;
                        sound2.play();
                   // ball 2 y coordinate.
                   else if (y2_pos > (bounds.y + bounds.height) - b2_radius || y2_pos < bounds.y + b2_radius)
                        y2_speed *= -1;
                        sound2.play();
                   // Checks the distance between the balls. If it is less than the sum of the radii, then they are colliding.
                   p = Math.sqrt(Math.pow((x1_pos - x2_pos), 2) + Math.pow((y1_pos - y2_pos), 2));
                   if (p < (b1_radius + b2_radius))
                        // To check there is a collision. Useful for debugging.
                        // System.out.println("Collision");
                        hasCollision = true;
                        // see declaration for details
                        if (!debugCollisionTesting)
                             x1_speed *= -1;
                             x2_speed *= -1;
                             y1_speed *= -1;
                             y2_speed *= -1;
                             sound1.play();
                   else
                   { hasCollision = false; }
                   // Move both balls.
                   x1_pos += x1_speed;
                   y1_pos += y1_speed;
                   x2_pos += x2_speed;
                   y2_pos += y2_speed;
                   // Repaint the scene
                   repaint();
    }Cheers
    Sutasman
    Edited by: Sutasman on Dec 6, 2009 1:17 AM

  • Table and table field for PICKING QUANTITY.

    Hi friends,
           I need to use PICKING QTY in script. but it is in structure LIPSD-PIKMG.
    Please say Table and Field for Picking quantity.
    I need a table and field.
    THANKS in advance.
    balaji.

    Hi Tarani, Rasmi,
    Thank you for quick response.
          LIPS-LFIMG is Delivery Qty . It is not Picking Qty.
    please let me know for PICKING QTY to display in my Script.
    Thank you.

  • How to use Database adapter as inbound adapter without having polling strategies?

    Hi All,
    I have a requirement wherein I have to use Database adapter to retrieve the data for every half an hour from one(X app) database and update that data into another application(Y app) .That database adapter will be along with BPEL process.My Flow would be like this:
    Database Adapter( In 'exposed services' section) ----->   BPEL (in 'Components') -----> Y app service( in 'External References' section)
    My questions for each step are below
         1) I have to retrieve the data from database(x app database) for every half an hour.So I have to schedule my whole process such that it should execute for every half an hour.
    Means I have to get  whatever the data is updated in the last half an hour in that database.
          The database adapter should be inbound in SOA composite editor(in 'Exposed services' section).
    But in order to have inbound adapter,we have select the 'Poll for New or Changed Records in a Table' option in turn we have to select one of polling operations below:
             Delete the Row(s) that were Read
    Update a Field in the [Table_Name] Table (Logical Delete)
    Update a Sequencing Table
    Update an External Sequencing Table on a Different Database
    Control Table Strategy
    But the problem is I don't have any control on the database(X app database) ,So (I can't update any data on that table,because that table may not have a field or table to update the processed rows)I can't choose any of the above operations.
    How can I achieve what I want that is to retrieve the data and schedule the process?
    Thanks in advance.

    Hi Heckler,
      Thank you very much for your answer that I can proceed further somehow.
    I still need to have some clarifications.
    In order to have a process which retrieves the data (Inbound operation) and updates the data into other application, the data(from X app)  should be the request(through DB adapter) of the BPEL process.
    X app does not do anything to send.We have(the BPEL process) to receive the data (or) no event is triggered.
    The flow :
    Database Adapter( In 'exposed services' section to retrieve data) ----->   BPEL (in 'Components') -----> Y app service( in 'External References' section)
    How can we ensure the data will be  request to BPEL process(means it will be in 'exposed services' section in SOA composite editor) for every half an hour if we use pick activity and database adapter as first activity?
    When we use ''Poll for New or Changed Records in a Table' ,then only adapter becomes inbound and comes into the 'exposed services' section.I can't use it as I don't have any control on the source table.
    I have this confusion before starting the process.Please help me to clear out the doubts.
    And this whole process should be executed automaticallly for every half an hour(means it creates instance for every half an hour)  Once we build the BPEL process.
    How to schedule it?
    And where do I need to create control table ?You mean I have to use some different database where in I have to create the table?

  • How to pick up goods in sales order

    While creating sales order  by VA01 i am not able to pick the goods by using picking button. There is no error msg. showing but in the picked button its showing 0 .  Am using 000 server in R3 4.7.   pls suggest me how to solve the problem .

    Hi there,
    Picking in sales order level? It is done in delivery. Not sales order.
    After creating delivery, check in picking tab what is the entry in overall picking status & Overall WM status. If the entry in overall WM status is A WM transfer order TO required, then you will need to create a Transfer order & confirm it to pick the quantity. In that case, pick quantity will show 0 in grey mode.
    If you maintain an entry in SPRO -> Enerprise structure --> Assignment --> Logistics Execution --> Assign warehouse num to plant & storage loc, then you will need to pick through a TO.
    After the TO is confirmed, then pick quantity is updated automatically.
    Create TO in LT03, confirm TO in LT12
    IF there is no requirement to create a TO for picking, then you can enter the pick quantity manually & save.
    Also check if the item is relevant for picking or not in over all pick status.
    Regards,
    Sivanand

  • How to use both At USER-COMMAND and AT LINE-SELECTION in one abap program

    I am trying out a program where I need to use both line selection and user command events in one program. Suggest me how to do it.

    USE the okcode 'PICK'. (I mean add a 'PICK' in the GUI staus or the menu.) When ever u use both the events u have to use PICK to trigger the at line selection.
    U just need to add the PICK in the GUI status and ofcourse write code in the program.
    AT LINE-SELECTION.
    CASE sy-ucomm.
    WHEN 'PICK'.
    write:/ 'HELLO WORLD'.
    ENDCASE.

  • How to read multiple files of different name using single file adapter

    There are two inbound locations inbound1 and inbound2 , and the files structure present in these two inbound locations are same but the files start with different names example
    (1)files in inbound1 starts with file1,file2...
    (2)files in inbound2 starts with abc1,abc2...
    by using same file adapter with read option how can i read both files....

    Hi K.A.N.N.,
    You can define multiple directories using the above link in 11g and poll for the file as \*.*.
    Alternatively you can use the Synchronous Read and specify the file name at runtime.
    You can also use Pick activity to define multiple branches each with a File Adapter to read from a specified location with specified file name. Although it would contain multiple Adapter Definitions at Development-time, only one of the Adapters will execute at Run-Time.
    Regards,
    Neeraj Sehgal

  • Pick activity is not working properly while creating two or more file adapt

    Hi,
    pick activity is not working properly while creating two or more file adapter for bpel process.
    bpel process compiled and deployed succesfully but while observing the wsdl file of deployed process you can find only one file adapter. so it polls only from that location.
    can anybody help on over this? or it's limitation of jdev to use only one file adapter at time while using Pick.
    Thanks
    sagar

    Does anybody tried this?
    Thanks
    sagar

Maybe you are looking for