FarSeer : Remove Object On MouseClick - c#

I'm still developing a small game, where I want to remove boxes when I click with mouse using FarSeer Engine 3.3 [if there is a solution I may already use 3.1]
Do not show me the example sources [i've them all, already and digged them deeply] my problem stays by checking colliding of mouse with the object. At FarSeer all objects are in interaction on a world, i have to pass my mouse to this world, where it may not do anything except i want.
How can I success a function IsTheObjectClicked [by Right or Left Mouse] at FarSeer.
(more, do not give any documention from FarSeer's webpage it is not update]
Thanks

Your Mouse is not a Farseer Body, it is an input, and is handled as an input by the XNA framework.
You could create a Farseer Body, and apply the active Mouse position to it, effectively mapping the mouse position to the Body. This would allow you to interact with your Farseer world using your Mouse.
You could also just grab the mouse position when clicked, and do a position check to see if there are any Shapes at that location, and remove them.

Related

What tells unity that a cursor is hovering over a button and how can Unity Netcode for Gameobjects affect it?

What tells unity that a cursor is hovering over a button (how does it know when to highlight it or do something when a click happens and the cursor is on it). And how does the Unity Netcode for GameObjects affect it? I have a problem with my game that uses the Unity Netcode for GameObjects netcode and it has a problem so that when you are a connected client it doesnt register any cursor and UI interactions (when hovering over the UI element it doesn't get highlighted or when clicked it doesn't do anything)
Try checking any object below that GameObject, to not cover that button and to not have Raycast Target on.
Unity, to recognize a click or a hover, permanently calculate a raycast between World Space and your Cursor, so if it hits, and have the Raycast Target on, it will trigger on the first object it hit, ignoring others.

Bounding Player to path Unity

Lets say I have a path, could be a line or a curve in Unity and I wanted to allow my player to snap to that path and move along it how would I achieve this. This would look like either a cover system or something similar to how ledges work in Sly Cooper.
While if you want your player's movement to follow a path, there is a technique called WayPoint, which is simply using the build-in navigation system in Unity. There exist so many articles that teaching you how to manually build such a Way Point System, and at the same time, you can get a SimpleWayPoint module from the online assets store.
But if your player is controlled by user, which means the user can control it's movement, let's say pressing 'W' button meaning moving forward while pressing 'S' button meaning moving backwards, and the leftwards and rightwards movement are constrained by the path you defined, unfortunately I didn't find any mature technology which allows you realize this constrains.
However, in the project I accomplished several months ago, I manually handle the coordinates successfully, since I create a city whose streets strictly observe horizontal and vertical grid lines, I can easily controls the target gameobject's X and Y coordinates, by either using the build-in freeze coordinates API or manually reseting the axis values over and over again in the Update() method. So maybe you could using the Update() method to constrain the targets' coordinates by dynamically calculating it's coordinates using the functions representing the path, but I can imagine how complex it would be.
You could try using a navmeshagent, which will be enabled as soon the player would like to use this "auto movement". In your code you can set the destination and in your scene you can create a navmesh, which can be whatever shape you like
You can do it by:
Mark the position from where you want your player NOT to move forward/cross the line.
In your script, mention the position.
LOGIC
if, player position > position marked
then stop the movement,
SYNTAX
private void update(){
if(transform.position.x < -10){
transform.position = new Vector3(-10, transform.position.y, transform.position.z); // Here you can either use `Vector3` or `Vector2` according to your game
}
}

My character associated to Image Target barely moves

I'm developing an android augmented reality game using unity 3d engine and vuforia extension where I need to move a character over a image target.
The problem is when I associate the character to the image target (as a child of image target) the movement is like the character is "glued" to the plane, it barely moves from his position, it moves very slowly.
I already tested without using augmented reality and the moving of the character is completly fine, so I dont know what am I doing wrong ...
Thanks in advance.
There's no need for the object to compulsorily be a child of the ImageTarget. AR will work both ways.
Wherever you place your Object, it will calculate the relative distance of the ImageTarget and place the Object there automatically. So if your Object is on the Image Target(not a child) It will show the object on top, as it is. Just make sure you don't make the AR Camera a parent/child of any other object.
As for the object following the object, you can simply use the Tracking functions to Enable and Disable tracking, so the object disappears
I really hope this solves your problem.
I think I know what it is! Check your Inspector Panel to see if you've got a Rigidbody Element. They're usually very difficult to handle, try unchecking the Rigidbody element and see if it's solves anything.

Capture Kinect event to a scatterViewItem

I'm attempting to adapt a MSSurface application to allow use of a Kinect. Using the code4fun libraries, I'm able to generate an event from the Kinect when a user puts their hand towards the screen, but what I'm missing is how to trigger a ScatterViewItem's touch or click event to grab item, and then release it once finished moving. from the kinect skeleton model I can get adjusted x/y co-ordinates which i could apply if I can trap the right events in the ScatterViewItem.. And code suggestions would be appreciated...
regards,
Rob
If you are just looking to move the item, the easiest thing is to set the ScatterViewItem's Center property to the translated x/y coordinates. You can then control when the item is 'grabbed' fairly easily using whatever conditions you want.
If you are also after pinch/zoom, you'll have to do some playing around. Since the Kinect doesn't have the resolution to detect the fingers pinching and zooming, you could implement this by mapping the Z coordinate of the hand to preset sizes on the grabbed ScatterViewItem.

Normalize and smooth the mouse movements?

Is there a way to smooth out the mouse movements? I want to remove all the small jitter in normal mouse moving with the hand, like you can never draw a clean line in paint because of you hand doing small jittering movements.
This might be hard to understand what I mean, but if you know zbrush they have a feature that is called lazy mouse http://www.pixologic.com/docs/index.php/Lazy_Mouse im looking for a way to recreate this inside my app. I can read the mouse position with Cursor.Position but I don't find a way to average out these numbers before they get sent to the pointer on the screen.
This is only possible if you can delay the effect of the mouse movement slightly. You record the points of the mouse movement at a certain frequency and then average them out to a line. Then use that line to draw whatever you need. You wont be able to directly set the mouse cursor to the averaged position as that would then feedback into your program as a new mouse movement.
Make sure you build it so you can tweak how long you delay the mouse movement, and how aggressive the averaging is (say by restricting the number of points it includes), and the frequency at which you record mouse movements (this is could affect cpu usage if its too frequent).
You will of course have to create some sort of abstraction for the mouse in your application and create a way for the application to get hold of it. (I would be trying to keep this as similar as possible to normal winforms/wpf so I could revert the change and just use mouse movement directly if needed).

Categories

Resources