Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Missile code? (http://www.alice.org/community/showthread.php?t=10960)

Killerzeron 01-08-2015 11:10 PM

Hey raven, Thanks for the help. I managed to make up the codes through ur codings. thanks for the help again and ill let you know when my sim is ready.

RavenOfCode 01-09-2015 08:36 AM

Cool
 
Good job :) And if you ever need help I'm sure me or someone on the forum can do it :)

Killerzeron 01-09-2015 10:11 PM

[QUOTE=RavenOfCode;55339]Good job :) And if you ever need help I'm sure me or someone on the forum can do it :)[/QUOTE]

Hi raven,

do you know how to make a restart command? i mean like:

I just want to make the plane go back to its starting position, i dropped a 3d text at its start position. So what i want is that when the plane gets closer to 0.5-3 meters it goes back to its starting position( at the text acting as a checkpoint-like). I tried using if than else but i dont know how to make up the code for it. If it comes in contact within 0.5-3m of any object, anything, it goes back to its start position. And i want this command to be looped forever which i know how to do but, what i did was


I made a method in the MG-29 on it restart command, I used the proximity functiion on the if/else condition( if MiG-29 is within Threshold of object{how to make it as anything?} then do " MiG-29 move to start position>3D text<)

the problem here is, how to make it as anything??

thanks,

Killerzeron

sfunk 01-10-2015 01:35 AM

Use a world variable. Make it a object variable. Make it a list as well. Put each object you want collision with in the list. That's one way to do it.

Killerzeron 01-10-2015 05:10 AM

[QUOTE=sfunk;55344]Use a world variable. Make it a object variable. Make it a list as well. Put each object you want collision with in the list. That's one way to do it.[/QUOTE]

Hmmm...thats basically not the only way. One of my friends figured it out but i cant. A method different than urs. Thats why im asking here. I have everything i need but i miss it out rarely.

RavenOfCode 01-10-2015 07:48 AM

Interesting Problem
 
One thing I would do is make separate methods for the different things the plane is colliding with, as Alice currently can only use the centers of the object to collide rather than the polygons that make up the object.

My suggestion is 2 basic colliding methods:
1.this would be for buildings/other planes/whatever.
Make a method called planeCollide > add ifelse statement > add loopInfinityTimes > add the function if Mig29 is within 1 meter of world > make 2 paramerters, 1 for a distance and replace the '1 meter' with this parameter, the other is an object replace 'world' with this > put the ifelse statment inside the loop > make another method > put a doTogether in it > then place planeCollide into this and us the parameters for the object you want/distance you want. (inside the ifelse statement you can put the code you want for it to reset)

2. This would be for the ground.
Make a method called collideWithGround > add ifelse statement > add loopInfinityTimes > put if else into loop > added the function 'mig29 is below ground' > then put in what you want to happen for when it crashes into the ground > then call this method in the events tab.

Hope this helps, also Alice come with a pre enstalled flight sim, in tutorials, you might want to take a look at that :)

sfunk 01-10-2015 03:21 PM

You'd still have to make a variable list to use the object parameter if he wants the method to work for all objects this way.


[QUOTE=RavenOfCode;55346]One thing I would do is make separate methods for the different things the plane is colliding with, as Alice currently can only use the centers of the object to collide rather than the polygons that make up the object.

My suggestion is 2 basic colliding methods:
1.this would be for buildings/other planes/whatever.
Make a method called planeCollide > add ifelse statement > add loopInfinityTimes > add the function if Mig29 is within 1 meter of world > make 2 paramerters, 1 for a distance and replace the '1 meter' with this parameter, the other is an object replace 'world' with this > put the ifelse statment inside the loop > make another method > put a doTogether in it > then place planeCollide into this and us the parameters for the object you want/distance you want. (inside the ifelse statement you can put the code you want for it to reset)

2. This would be for the ground.
Make a method called collideWithGround > add ifelse statement > add loopInfinityTimes > put if else into loop > added the function 'mig29 is below ground' > then put in what you want to happen for when it crashes into the ground > then call this method in the events tab.

Hope this helps, also Alice come with a pre enstalled flight sim, in tutorials, you might want to take a look at that :)[/QUOTE]

RavenOfCode 01-11-2015 08:27 AM

Or
 
Or... as I said list the objects he wants to collide with, ie. copy the method into a dotogether and set object to house (or something) and a width for the object.

sfunk 01-11-2015 08:59 AM

That is just an over abundance of code when you can just streamline it with a list variable.

RavenOfCode 01-11-2015 11:07 AM

Yea
 
I do realize that and that is what I suggest doing, however he asked for an alternative route, this is the best solution as an easy to understand alternative.


All times are GMT -5. The time now is 02:47 AM.

Copyright ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.