I want to ask you How can I make simulation of car crash ?
On the internet I found http://www.gamedev.net/reference/articles/article1459.asp .
I think about using finite-element-method, but now I think it is too difficult for me :/
Do you know any good, not too accurate and not very hard-to-learn methods to simulate collision of two bodies ( two cubic cars ) with deforming?
My first idea was to made these cars with some number of rigid bodies, and connect them, but I don't know if it is good idea :/
Try reading this paper for starters. This and the references therein should point you in the right direction, more or less.
Related
I want to write a code for my Ev3 robot with two motors. I want it to be able to go a certain distance, in this case forward until the motors have turned a maximum of 2500 degress for four seconds. Then I want the robot to go back the same distance. But the problem is that sometimes only one motor spins while the other does nothing and sometimes a motor will continue to spin long after it has returned to its original position. I wonder if there is any way I can improve the code I have. I have tried it on several different Ev3 equitment so it is most likely not a hardware problem. Any help would be appreciated :)
b = Brick('ioType','usb');
b.outputStepSpeed(0,Device.MotorA,60,0,2500,0,Device.Brake);
b.outputStepSpeed(0,Device.MotorD,60,0,2500,0,Device.Brake);
pause(4)
b.outputStop(0,Device.MotorA,Device.Brake);
b.outputStop(0,Device.MotorD,Device.Brake);
tacho = b.outputGetCount(0,Device.MotorA);
disp(['> Tachometer: ' num2str(tacho)]);
b.outputClrCount(0,Device.MotorA);
b.outputClrCount(0,Device.MotorD);
pause(0)
b.outputStepSpeed(0,Device.MotorA,-60,0,tacho,0,Device.Brake);
b.outputStepSpeed(0,Device.MotorD,-60,0,tacho,0,Device.Brake);
pause(4)
b.outputStop(0,Device.MotorA,Device.Brake);
b.outputStop(0,Device.MotorD,Device.Brake);
tacho =
b.outputGetCount(0,Device.MotorA);
disp(['> Tachometer: ' num2str(tacho)]);
b.outputClrCount(0,Device.MotorA);
b.outputClrCount(0,Device.MotorD);
clear
do check if your ports are correct and if they are connected. Do also know that not all EV3 motors are manufactured perfectly the same which means some can be stronger, making it almost impossible to move straight. Using a gyro might help out in this case.
Do comment if you need further help!
I'm trying to make a simplified version of crazy taxi . For the first step i need to make an infinite ground . I'VE searched online but couldn't find any examples .
Can i find any example of how to do this ?
https://www.youtube.com/watch?v=rhTPxrJICVg&list=PLLH3mUGkfFCXQcNBz_FZDpqJfQlupTznd
N3K makes an infinite runner in Subway Surfers style, meaning ground coming from the back and going towards the camera.
The above link is to his tutorial series.
This is a very broad question I try to give a very simplified answer to get you going.
To create endless road you need some sort of procedural function that generates corners for your track. If you do not need to backtrack you can cook something up yourself like (in X distance turn X degrees to the right). If you do need to backtrack you need something like perlin/simplex noise that always generates the same value based on 1 or more other values. You could use total distance to get the curve in the road.
You simply keep generating the world on the fly and unload pieces of the world you don't need any more. If the player can alter the world like destroying street furniture or leaving skitmarks you need to implement a chunk system. When you backtrack and generate a cerain part of the world with your procedural function you can have permanent changes the player made in that specific part by saving and loading to the chunk. Much like Minecraft does it actually.
I,m creating a dungeon generator in unity3d. I have a pile of prefabs(rooms, corridors, junctions). Randomly a piece is chosen for starting piece and then depending on the connecting rules next pieces are chosen. Also the dungeon can be multi layered. Like 1 room above the other etc. Problem is room collisions. On the same layer 2 rooms can be placed on top of each other and this is a problem.
My first idea was to use arrays to model the layers and then find best suiting locations for stairs up and down. But the problem with this is that not all angles are 90degrees. I have a 3 way intersection in the shape of Y. So everything that comes after this is angled. And its not easily represented on array.
Second idea was the use of collisions and backtracing. I place the tile and then if no collision I can move forward. But if collides I try to find a better suiting piece or remove the previous piece and but something new there. But I can't figure out a good method to do this.
Anyone have any suggestions or ideas on how to generate multilayered dungeons with non 90 degree angles?
This could be a really broad question, but if you can help me with ideas, it would be a great help to me.
I am trying to implement basic path finding algorithm in matlab. I have to create a map where the robot can navigate and also avoid obstacles and reach destination. I have the algorithm fine with me. But am struggling with the gui as I haven't used much of Gui in matlab.
This is the following idea I had.
I created a plot and just defined 4 coods for each obstacle, destination as a circle and a start point. But am stuck when I think how I can detect whether the robot has hit an obstacle or not. One way is to create the equation of line and try to see if the point ever comes to lie on it. But the movement is based ona random generated variable. Thus it is possible for the robot to cross the line and get inside the polygon.
My apologies for bein too elaborate, but can you please tell me the best way to implement this in matlab? It is mandatory to do this in matlab. Please suggest me a better and easy way to program it. Thanks in advance.
If your obstacles are all polygons you could try to use the ray casting algorithm described on the following wikipedia site.
Point in polygon algorithm
With this you should be able to determine if the robot position lies within an obstacle, or you could determine if the next movement will bring the robot into contact with the obstacle.
If you are looking for a simple algorithm that can take care of obstacles inherently i would suggest the potential fields algorithm (can get stuck in certain cases)
Potential Fields
else you can also try the A* algorithm, which is better in my opinion; Good description of A*
After some sample projects, I have started with my first game in cocos 2d and box 2d where objects fall from a parachute and you kill them using slingshot. Now i'm stuck # couple of things for a while:
Collision Issue:
Using Box 2d i have made collision with objects. However when i add a counter to get a count of my collision i doesn't work. Counter increases even though the percentile is moved out of the screen.Don't know how to get rid of this.
I'm trying to get random rotation to my sprites which fall from above, Like a parachute experience. Now all of then rotate # a same angle.
Lastly i need to get rid of the surrounding sprites when collision happens. Ex: When the percentile collides with a falling object, in a radius of 2.5 cms the other sprites should also disappear.
I Badly need help and suggestions, hence all the 3 questions # once :-). I have provided the link for my project so that you can look # the source code. Desperately looking for your help guys!!!
Download Source Code:
http://jumbofiles.com/6fn5mmpnq1q8/Karthik.zip.html
Budding Developer,
Karthik
You have a pretty good tutorial here: http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12
I think that one can solve your problems :)
You can get the best tutorial for the particular requirement you have described over here.....
The link for that is as follows
http://www.raywenderlich.com/606/how-to-use-box2d-for-just-collision-detection-with-cocos2d-iphone
The tutorial is of 2 parts and describes the code briefly.. The code of that is described and you can get good amount of help from there.
ques 1 + 3: you need read link which share by Mikael and Marine
ques 2: in cocos2d, if you want get random value, you can use support function (such as: rand(), random(), CCRANDOM_0_1() ....)... i think, you need set rotation value for object. i dont know your problem, you need explain it (link is "File Not Found or Deleted / Disabled due to inactivity or DMCA")