Drag and drop on Physice Body in libgdx - drag-and-drop

I am using libgdx for rendering and Box2D for physics.what is the way to do drag and drop on physics body in libgdx.(touch and drag drop)

You can use mouse joint to the body which you want to drag and drop. Using mouse joint you can pick up body and drop it where you want.

Related

In unity why cannot Instatiate a gameobject

I am currently coding in Unity and I am trying to Instantiate a gameObject. The mechanism I'm developing will delete the Image I'm on and load the image underneath, using two buttons ; One to create and one to delete thus giving the effect of moving through a graphical stack.
I have thought about moving the image forward along the z axis so it is out of view, but I have read that the object MUST be instatiated and not Transformed
I have a Rigidbody2d and (2x) 3D Box Collider over the image that has the code. One on the left and one on the right
The delete button works a treat and just to check I do not have a problem with the box collider I have tried the delete code on the other button which also works fine, so I have come to the conclusion that the code is flawed in some respect
My problem is that I cannot seem to recreate the object once it has been deleted, it is my understanding that the object does not have to exist in world space for it to be recreated. If I use the Quaternion Identity I get a few errors about the gameObject being rendered off screen
***
Instantiate(gameObject,new Vector3 (8,-17,11),
// Removed until I can actually get the image to Instantiate
Quaternion.identity);
***
I have also tried
***
Instantiate(gameObject,new Vector (gameObject.transform.position.x -0.08, gameObject.transform.position.y, -0.17, gameObject.transform.position.z, 11), Quaternion.identity);
}
}
***
Can someone please tell me what I am doing wrong?
I am fairly new to Unity too, but I believe what you need is a Button that Swaps the Sprite image.
Select your Button in the Hierarchy.
In the Inspector:
In the Image component, drag in the first Sprite
In the Button Component:
select the check box Interactable
select Sprite Swap in the Transition Drop Down
drag your second Sprite to "Selected Sprite"
I am fairly new to Unity too, but I believe what you need is a Button that Swaps the Sprite image.
Select your Button in the Hierarchy.
In the Inspector:
In the Image component, drag in the first Sprite
In the Button Component:
select the check box Interactable
select Sprite Swap in the Transition Drop Down
drag your second Sprite to "Selected Sprite"

Touch not detectable past Panel - Unity3D/Vuforia

I have been trying to add touch event to 3D gameObject in Unity.
Previously I was not using any Canvas or Panel so by using Event Trigger and Event System I was able to add touch events to the Gameobject but then I wanted to use a UI for Application and implemented this hierarchy.
Camera
GameOBject
Canvas
Panel(Transparent)
-Buttons
Panel2
EventSystem
So if i tap a part it does not respond.
Camera does have Physics Raycaster.
Gameobjects have colliders and mesh renderers.
I want a touch input from the mobile device.
Thanks
If two Button overlap each other then the order in which camera renders top will be detected.
So try changing the hierarchy order (remember the last in the hierarchy is always top of the camera ) you can achieve which one to click

How to drag rigid object using mouse in unity 5

The rigidbody.js built-in in unity 5 doesnt work for me. Im trying to drag and drop a rigidbody using mouse drag and drop. Any help will be appreciated.
Here is a link to get you started, haven't tested but it should work fine with an object that has an attached rigid body. Drag Object with mouse

Capsule Collider Is not available in first person character settings in Unity 5

I'm learning Unity 5 and I have made simple game scene which has a coin and I wrote a code to collect a coin by first person character and when he walks towards the coin. So I dragged and dropped my code into coin layer in Hierarchy but to make this feature available I need to check the little checkbox of Is Trigger at my FPSController settings at the right side. The problem is Capsule Collider is shown at all and I really don't know why! There MUST be a section which is called Capsule Collider with Is Trigger option under the Audio Source. But as you can see ,it's not there & I don't know how to find it.. see my print screen
If it does not display in your Scene View, Enable it in the Gizmos by clicking on it.
Then under Built-in Components, make sure that Capsule Collider is selected. It show now show in the Scene View.
If it is not in the Inspector or not attached to your FPS Controller, add it by yourself.
Select the FPS Controller, Got to Component->Physics->Capsule Collider. You can then resize it.
You can add the Capsule Collider into your character yourself. All you have to do is select your character, scroll down the Inspector panel, click add component, search for Capsule Collider and select it.

i want to drag object(box2d) with the touch position in cocos2d+box2d iphone

Guys
i want to drag a box2d object from touch move method in iphone
i have used the mouse joint but it is not working perfectly as object fluctuating within it's place like it is tied up with rubber
help is appreciated
thank you very much
The mouse joint is essentially a rubber band.
Destroy the body temporarily while dragging and re-create it again in -(void)onTouchEnded.