Alice Community Collisions in Alice - preventing character running into walls

 Collisions in Alice - preventing character running into walls
 4rianna Guest   Status: Posts: n/a Collisions in Alice - preventing character running into walls - 04-23-2012, 09:03 AM After sfunks's collision tutorial I tried using collisions and they worked really well. I can make instances of the alice character/animal objects collide but am having issues with making my scientistWoman collide with the walls of my layout. I created a 'map' in 3DS max and imported it to Alice. Once in Alice I saved it as an object and left the first instance of it as there don't seem to be any problems. Map: (Centre wall), (floorlane1, ... , plane23), (wall:wall003, ... , wall008) On creating an event 'When world is running: During: run world.collision [building.wall]' Where world.collision is IF scientistWoman is within 1 metre of [objectToHit] scientistWoman move backward 1 metre duration 0.1 sec style abruptly ELSE nothing and [objectToHit] is a parameter, in this case building.wall Problem: I'm making a FP game and my character just moves through the walls when I want it to collide and NOT walk through the walls. Any ideas would be appreciated, thanks for your time!
 Mr Kidnapper Senior Member   Status: Offline Posts: 442 Join Date: Feb 2011 04-23-2012, 09:53 AM I'm not sure what collision method you're using. Mind elaborating? I'm assuming that this is just a check for if an object is near another and then force them to move backwards. If that's the case then I probably know what's wrong. See, you're trying to make a wall collision act like a sphere collision. What "1 meter away from" does is check if an object is 1 meter away from the object's pivot point in a circular radius. What you should use is "To the left of", "In front of", and use the wall's length, width, and height to calculate the wall's collision as a rectangular prism.
 4rianna Guest   Status: Posts: n/a 04-23-2012, 10:27 AM See, you're trying to make a wall collision act like a sphere collision. What "1 meter away from" does is check if an object is 1 meter away from the object's pivot point in a circular radius. What you should use is "To the left of", "In front of", and use the wall's length, width, and height to calculate the wall's collision as a rectangular prism. Of course, sorry. It is a check! When I said collision method I meant a method I'd written causing what I think looks like a collision. Apologies for imprecise terminology! The method was: (parameter is objectToHit) IF scientistWoman is within 1 metre of [objectToHit] scientistWoman move backward 1 metre duration 0.1 sec style abruptly ELSE nothing Basing on what I understood in your post I now have: object parameter = objectToHit local int variable = distanceFromObject distanceFromObject set value to scientistWoman distance in front of objectToHit IF scientistWoman distance in front of objectToHit <0.1 scientistWoman move backward 1 meter duration ELSE nothing The walls are not just single rectangular walls but if I just go through them one by one, applying that method it looks like it will work well! I used the above on a wall object that is a hexagon and it seems to take the area as a square and calculate distance in front of.. from the edge of the square. Thank you, I really appreciate your time.
 Mr Kidnapper Senior Member   Status: Offline Posts: 442 Join Date: Feb 2011 04-23-2012, 06:14 PM Yes, the width, height, and length that Alice refers to is the width height and length of the bounding box of the subobject, which is why if you want complex collision you need to separate an object into simple primitive objects, maybe even use an invisible, low poly collision "proxy" (That's what my community calls it), in this case made out of Alice spheres and rectangles. Though to elaborate, this is what I mean: http://alice.org/community/showthrea...3&postid=44920 Read the next few posts after it as well as the link inside the post. Last edited by Mr Kidnapper; 04-23-2012 at 06:18 PM.

 Tags collision, collision detection, collision methods, collisions

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge