Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I was following this tutorial:
https://www.codeproject.com/tips/357063/a-very-simple-car-race-game-in-csharp-and-opengl
Determining place in this game is trivial, as the cars only move in one dimension on a straight line. How would it be done in more generic maps with the cars moving in more than one dimension?
EDIT:
By place, I mean 1st, 2nd, 3rd place, ad nauseum.
How do you determine which car is closer to finishing than the others?
In 3D Racing Games, how is place determined?
By that I assume you mean position.
If so by a simple scalar quanity.
Cars on a 3D race track in a computer or reality, are still constrained to being on a "road". Assuming no intersections, you can ignore the third dimension. Because a track is a loop, you can also unwind it and any point on the path can be a scalar value between 0 and 1 with:
0 being the start of the track
0.5 half-way along; and
1 reaching the start again
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have switches in Unity 3 that I operate with my player. At the moment I set one variable each to TRUE.
Now I want a trapdoor to open after pressing the switch. But this should only happen if you press the switches in the right order.
How do I solve this in C# code?
Don't get into the logic.
Maybe somebody with a code example can help me how this could look like. It could be pseudo code as well.
Thanks
Have a collection that contains the IDs of the switches in the order you expect.
When they press their switches, add the ID of the switches to another collection.
When collection length == number of switches, compare the IDs in the collection to the IDs in the same position in the expected order. If they match, then open the trapdoor.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
My problem is simulation of soft object deformation on user interaction, like when you touch ball with sand inside it deformes its edges in spots you press on ball. How can I achieve it in Unity3D?
Soft body dynamics is a very complex topic, which is why most physics engines constrain themselves to rigid body dynamics. I am pretty sure that no one on StackOverflow is going to code this for you. There are some commercial solutions for Unity though, Obi Softbody and Truss Physics to list a couple.
Here is a cheaper but probably less feature complete option:
https://assetstore.unity.com/packages/tools/physics/b-soft-body-deformation-53378
There are many different ways for simulating soft body physics, one common way is to map the vertices to a lattice of points (with some weight), and then simulate spring contraints between the lattice points. These types of lattices are probably best simulated with verlet integration.
Here is a research paper on lattice shape matching.
Here is another paper on pressure models.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a 2D array of size [3000,3] and I have to find Euclidean Distances between the 3000 values in first dimension 3 times (second dimension).
What I am doing now is makin a nested for loop, I looked for ways of making it faster, but the only think I found was setting up a structure as here.
Perhaps doing 3 for loops is faster than doing a nested loop. Does anyone know how the processing time goes in this case?
It won't matter at all whether you run a loop three times via nested-loop or via separate loops, as long as the amount of iterations are the same.
If you can improve your algorithm, so that you need fewer iterations (fewer than 3000 x 3), that might get you somewhere.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am implementing 2d-bin-packing algorithm in canvas. My task is to place rectangles as optimal as it can be on a canvas.
the following shows how to do it:
http://incise.org/2d-bin-packing-with-javascript-and-canvas.html
BUT, it starts with the origin. I would like to tell the algorithm where to put a rectangle and that the next one not to be on top of him.
What should be changed in the code?
Is there another algorithm to use for it?
I know a better algorithm(in terms of compactness, not speed) than the one you linked to is called MaxRects.
This was my implementation of it in C++. While not fast, it was very effective at packing compactly.
This is a pdf discussing and comparing all sorts of algorithms in terms of both time and compactness.
EDIT:
I threw together an example of an image packed using MaxRects .
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have to develop a small application that gets some images and then counts the items in the image. It is something like a satellite image with a road and I need to count the cars.
Can you give me some hints where to start? I am completely lost.
Thanks a lot,
Radu
Have you checked out OpenCV? Emgu CV provides the .NET bindings
Image processing library:
OpenCV or if you have Matlab with the image processing toolbox it would be very nice.
Algorithm wise
Counting cars on a road is not as simple as it appears. Lets suppose they have a invariant scale (say 1.0).
Create yourself a Hough transform algo to vote for rectangles with about the same width and height as your cars.
In your vote buffer find the 'n' greatest vote scores and this is your number of cars.
This is not so complicated and OpenCV can be pretty useful. You can estimate the maximum value of your hough score for each car so you can set thresholds to skip outliers.