sidebar features
sidebar content

Go Back   Blender Artists Forums > Game Engine > Game Engine Resources

Reply
 
Thread Tools
dfelinto's Avatar
dfelinto dfelinto is offline
Member
 
Join Date: Jun 2005
Location: Rio de Janeiro, Brasil
Posts: 396
Hi folks!

This week I spent most of my time creating a boundary system in BGE. And now I'm looking forward to sharing it ...

A small animation showing the system working: http://www.youtube.com/watch?v=P108MdGliyM

And check the blend file attached ... (just open and press "P")


How it works:

Setting the boundary:
1) I have two boundaries per object, the Inside boundary and the Outside.
2) The two boundaries are nominated following the rule: "Boundary_" + obj.name + "_I"(or "_O") - (e.g. "Boundary_Suzanne_I")
3) The boundaries are Collision enabled and have the property: "B_" + obj.name (e.g. "B_Suzanne")

Setting the object:
1) Create an Always sensor, link it to the script boundary.py and link it to a movement Actuator called "MOVE"
2) Make sure the center of the object is in the center
3) Add the objects through an AddObject Actuator (that way they all have the same name)



Now you can setup your own boundary using the script the way it is. If you need extra customization, please feel free to share the results here



Problems you may have:
1) If you are parenting the boundaries to another object (e.g. the visible fake boundary in the example file), remember to apply the scale in the parent or else odd things will happen - BUG REPORT.
2)Elif the outer boundary is not tight with the inner boundary, depending on your pulse set to the sensor, the rayCast will hit the "outer face of the inner boundary". Right now, in BGE, is not possible to check the normal of the face we are hitting (or atleast in a fast/cheap way). Therefore we have these two boundary objects, and they should be very tight.


Problems I have :
I'm using multiple boundaries. For each object I have a different boundary. As the rayCast function doesn't have an X-Ray mode yet (BUG REPORT) the rayCast returns None when the boundaries of other objects are hit, even if the object is inside its real boundary.

If you think this .Blend file will be useful for you, please copy this message below and post it as a commentary:

" DEAR BLENDER GAME ENGINE DEVELOPERS (Benoit, Campbell, and others) I love your work, and I'm very happy with all the current features available in BGE. BUT please code an x-ray mode to the rayCast function (or make it the default, as I still can't see why it is different ). "



As a matter of fact, I can see a way to solve this. I need only to set different height levels for different objects, and the RayCast fromPos and toPos parameters will follow. This is however, a hack, and does not solve the other problems I'm having with rayCast


Forewords:
* To run it properly you need the latest BlenderSVN (to use Mathutils). You can download it from Graphicall.org

* Thanks to Campbell (ideasman) for the support and the sheepNav.py file, and the Apricot team and developers for the incredible work. And a big thank you to all who supports Blender and Apricot (buying DVDs, reporting bugs, coding, ...).
Attached Files
File Type: blend boundary_BA_01.blend (227.3 KB, 33 views)

Last edited by dfelinto; 07-Aug-08 at 22:26.
#1   Old 07-Aug-08, 22:15   
Reply With Quote


mpan3's Avatar
mpan3 mpan3 is offline
Member
 
Join Date: Jun 2004
Location: Vancouver, Canada
Posts: 2,079
Sweet, how did you do the trails in your youtube video? I am guessing it's the motion blur 2d filter?
............................................
Mike's Blender site
#2   Old 08-Aug-08, 01:06   
Reply With Quote
Nickadimos's Avatar
Nickadimos Nickadimos is offline
Member
 
Join Date: Jul 2007
Location: Gallatin TeNnessee
Posts: 303
Hey thats nice! Good Job!

Terry
............................................
The Earth Laughs with Flowers : Ralph Waldo Emmerson
#3   Old 08-Aug-08, 08:34   
Reply With Quote
dfelinto's Avatar
dfelinto dfelinto is offline
Member
 
Join Date: Jun 2005
Location: Rio de Janeiro, Brasil
Posts: 396
Quote:
Originally Posted by mpan3 View Post
Sweet, how did you do the trails in your youtube video? I am guessing it's the motion blur 2d filter?
It is really nice. I was waiting for VIMEO accept my video to talk about that.

Test 01 - http://www.vimeo.com/1492170
Test 02 - http://www.vimeo.com/1492070

This tracking was made using the motion blur 2d filter with a very high value (0.997 I think).
The idea comes from .. you, hehhe

Thanks Mike
Quote:
Originally Posted by Nickadimos
Hey thats nice! Good Job!
Thanks Terry.
I'm still working on it. When my object go inside the inner boundary something it doesn't return back. (in the video you can see some of them).
#4   Old 08-Aug-08, 17:11   
Reply With Quote
dfelinto's Avatar
dfelinto dfelinto is offline
Member
 
Join Date: Jun 2005
Location: Rio de Janeiro, Brasil
Posts: 396
I coded a following ground script that probably will be integrated with the boundary.

The file is attached, press "P".

Also there is a cool think I would like to share:

Code:
How to syncronize dRot and Time Delay: dRot = ang * 1.2 / (time * LogicTick) for 60LT: dRot = ang * 0.02 / time
That way you can set the amount of rotation (in angles) you want the object to have in some time (in pulses).
This create a kind of offset. The object is always aligned with the ground that was hit in the last pulse. It's not a problem for me, and that way I have a smooth transition ...
(so far I was trying to follow the ground that way - http://blenderartists.org/forum/show....php?p=1184289)

Attached there is a test with different delay pulse values and the value in the script (rotX = angle * 0.02 / deltaTime).
Attached Images
File Type: jpg TESTES.jpg (48.0 KB, 15 views)
Attached Files
File Type: blend BA_Following_Ground.blend (240.1 KB, 11 views)

Last edited by dfelinto; 08-Aug-08 at 19:57.
#5   Old 08-Aug-08, 19:53   
Reply With Quote
ideasman42's Avatar
ideasman42 ideasman42 is offline
Member
 
Join Date: Mar 2004
Location: Australia
Posts: 3,490
Im sure this dosnt give the same level of control but heres a version that works with just 2 logic bricks, no python. (only with latest svn)
You should be able to adjust the settings through python to have some control at least.
http://members.optus.net/~cjbarton/BA_Following_Ground_NoPy.blend
............................................
BPython Cookbook * How to get features into Blender * Code Metrics
Hire Me
ideasman42<at>gmail.com
#6   Old 08-Aug-08, 20:27   
Reply With Quote
dfelinto's Avatar
dfelinto dfelinto is offline
Member
 
Join Date: Jun 2005
Location: Rio de Janeiro, Brasil
Posts: 396
I tested here and the performance is a little worse.

And check the path, is not so smooth:
http://img379.imageshack.us/img379/4205/ssbk3yj7.jpg

Maybe it is because the ray is not always vertical (since we are rotating the object? ).
Hm a good option would be to set the ray direction locally (considering the orientation of the object) or globally (as a global z ray as I'm using in the script).

Thanks Campbell (and thank Benoit )
#7   Old 08-Aug-08, 20:51   
Reply With Quote
Reply

Bookmarks

Thread Tools

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 Jump


All times are GMT. The time now is 17:30.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Logo and website design copyright © 2006 by froodee design bureau. All rights reserved.
Blender Headlines
Featured Artwork
Crocodile by Julia Korbut
Classic vintage look renders by HANGAR
Blending life - Old George by bigbad
Other Blender Sites
new icon Blender Homepage »
The official Blender homepage
new icon BlenderNation »
Fresh Blender News, Every Day
new icon Blenderart Magazine »
Blender articles, tutorials and images.
Social BlenderArtists