Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Tue Mar 19, 2024 9:53 am

All times are UTC




Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: Fri Jun 08, 2007 6:21 pm 
Offline

Joined: Sat Oct 29, 2005 12:43 pm
Posts: 65
Quote:
In your case maybe you could use 8 or 16 spheres per wheel to get the same effect positioned around the axis of the wheel.

I have thinked about that, but the car doesn't bump ? :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 7:01 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
hmm, maybe...
Then duplicate the number of spheres :P
No really, i'm not sure about how to focus that problem. Maybe it could be possible to add a new type of collision shape, a circle. Not sure.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 10:13 pm 
Online
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Rollcages works well with spheres, from what I've tested (KingHill car is quiet near that, for example). No ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 17, 2007 12:03 pm 
Offline

Joined: Sat Oct 29, 2005 12:43 pm
Posts: 65
Hello,

Right, I have re-install the old (but good...) Rollcage 2 and it's different of my mind ^^...
I see the wheels more height than width... but in the game it's same... so a sphere can make the job I think :)

I never see KingHill before :oops: . It's good, but I want the opposite gameplay ^^ (very reactive car, like with an electric engine and very "adhesive" wheel).


Top
 Profile  
 
PostPosted: Wed Jul 25, 2007 9:03 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Our animation plans could be in danger. Today the guys of the blenderpython channel have confirmed me that no one is making the Bvh exporter for raydium!!
And that's bad cause our system is based on that animation format

Someone that knows Blender api wants to do the exporter?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 08, 2007 9:13 pm 
Online
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Bad news. My own experience with Blender Python scripts is quiet painfull, so it seems to me almost impossible to write and maitain our own exporter for a subject as complex as animations.

Let's sum up all this:
- Blender can read BVH (it may be a good idea to test this, I think)
- Thanks to your work, we are able to read BVH
- Blender can't actually wrote BVH

Quiet tricky ...

Is Blender able to export reliably to another (text, if possible) format ? So we can then imagine a script to export this format to BVH.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 21, 2007 12:41 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
I didn't read your answer, sorry.

I have found this bvh exporter but is a bit special.
I only have found one blend file that worked.

As long as I know the armature has to be just one root. And it has to have selected before run the script.

Could a few volunteers to test this script and even if possible tweak it a bit to make it more flexible? :) Thanks

Code:
#!BPY

"""
Name: 'IK Capture (.bvh)...'
Blender: 237
Group: 'Export'
Tip: 'Export a (.bvh) IK capture file'
"""

__author__ = "Jean-Baptiste PERIN"
__url__ = ("blender", "elysiun")
__version__ = "0.4 05/12/01"
__email__= ["M. PERIN Jean-Baptiste, jb_perin@yahoo.fr", "scripts"]
__bpydoc__ = """\
This script exports Empty animation to bvh file format.

Supported: Poser 3.01<br>

Missing:<br>

Known issues:<br>

Notes:<br>

"""

#----------------------------------------------
# (c) Jean-Baptiste PERIN  december 2005, released under Blender Artistic Licence
#----------------------------------------------

import Blender
import math
empty_rest_ori = {}


def getRootBone(armature):
   rootBone = None
   for bone in armature.bones.values():
      if bone.parent == None :
         if rootBone == None:
            rootBone = bone
         else:
            print"Multiple root armature not handled"
   return rootBone

def getBoneCurPos(armature, bone):
   lempty = Blender.Object.Get(bone.name)
   return (lempty.getLocation())

def getBoneCurRot(armature, bone):
   lempty = Blender.Object.Get(bone.name)
   return (lempty.getMatrix('worldspace'))

def getBoneRestPos(armature, bone):
   return (bone.head)

def getBoneRestRot(armature, bone):
   lempty = Blender.Object.Get(bone.name)
   return (bone.matrix)
   
def indentString(i):
    string = ""
    for v in range(0,i):
        string += "\t"
    return string

def printBoneHierarchie (armature, bone, level):
   str = "%sJOINT %s\n"%(indentString(level), bone.name)
   str += "%s{\n"%indentString(level)
   str += "%s\tOFFSET %f %f %f\n"%(indentString(level),
                                     getBoneRestPos(armature, bone)['ARMATURESPACE'][0] - getBoneRestPos(armature, bone.parent)['ARMATURESPACE'][0],
                                    getBoneRestPos(armature, bone)['ARMATURESPACE'][1]- getBoneRestPos(armature, bone.parent)['ARMATURESPACE'][1],
                                    getBoneRestPos(armature, bone)['ARMATURESPACE'][2]- getBoneRestPos(armature, bone.parent)['ARMATURESPACE'][2])
   empty_rest_ori [bone.name] = getBoneRestRot(armature, bone)['ARMATURESPACE']
   print empty_rest_ori [bone.name]
   str += "%s\tCHANNELS 3 Zrotation Xrotation Yrotation\n"%indentString(level)
   if bone.children != None:
            for b in bone.children:
                if bone.name == b.parent.name:
                    str += printBoneHierarchie (armature,b, level+1)
        else:
            str += "%s\tEnd Site\n"%indentString(level)
            str += "%s\t{\n"%indentString(level)
            str += "%s\t\tOFFSET %f %f %f\n"%(indentString(level),
                                           bone.tail['ARMATURESPACE'][0]-bone.head['ARMATURESPACE'][0],
                                           bone.tail['ARMATURESPACE'][1]-bone.head['ARMATURESPACE'][1],
                                           bone.tail['ARMATURESPACE'][2]-bone.head['ARMATURESPACE'][2])
            str += "%s\t}\n"%indentString(level)
           
   str += "%s}\n"%indentString(level)
   return (str)
   
def printArmatureHierarchie(armature):
   rootBone = getRootBone(armature)
   str = "ROOT %s\n{\n"%rootBone.name
   str += "\tOFFSET %f %f %f\n"%(getBoneRestPos(armature, rootBone)['ARMATURESPACE'][0],
                                    getBoneRestPos(armature, rootBone)['ARMATURESPACE'][1],
                                    getBoneRestPos(armature, rootBone)['ARMATURESPACE'][2])
   str += "\tCHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation\n"
   empty_rest_ori [rootBone.name] = getBoneRestRot(armature, rootBone)['ARMATURESPACE']
   for b in rootBone.children:
            if rootBone.name == b.parent.name:
                str += printBoneHierarchie (armature,b,1)
   str += "}\n"
   return (str)
   

def printBoneFrame (armature, bone, level):
    mat1inv = Blender.Mathutils.Matrix(empty_rest_ori [bone.name][0],
                                    empty_rest_ori [bone.name][1],
                                    empty_rest_ori [bone.name][2],
                                    empty_rest_ori [bone.name][3])
    mat1inv.invert()
    mat2 = Blender.Mathutils.Matrix(getBoneCurRot(armature, bone)[0],
                                    getBoneCurRot(armature, bone)[1],
                                    getBoneCurRot(armature, bone)[2],
                                    getBoneCurRot(armature, bone)[3])
    mat3=mat1inv*mat2
    eul = mat3.rotationPart().toEuler()
   
    str = "%f %f %f "%(
        eul[2],
        eul[0],
        eul[1])
    if bone.children != None:
        for b in bone.children:
            if bone.name == b.parent.name:
                str += printBoneFrame (printBoneFrame,b, level+1)
    return (str)


def printArmatureFrame (armature):
    rootBone = getRootBone(armature)
    str = "%f %f %f %f %f %f "%(
        getBoneCurPos(armature, getRootBone(armature))[0],
        getBoneCurPos(armature, getRootBone(armature))[1],
        getBoneCurPos(armature, getRootBone(armature))[2],
        getBoneCurRot(armature, getRootBone(armature)).rotationPart().toEuler()[2],
        getBoneCurRot(armature, getRootBone(armature)).rotationPart().toEuler()[0],
        getBoneCurRot(armature, getRootBone(armature)).rotationPart().toEuler()[1]
       )   
    for b in rootBone.children:
        if rootBone.name == b.parent.name:
            str += printBoneFrame (armature,b,1)
    str += "\n"
    return (str)
      
def exportBVH(filename):
    global armaturename
    print "Exporting armature %s to file %s "%( armaturename, filename)
    startFrame = Blender.Get('staframe')
    endFrame = Blender.Get('endframe')

    outputfile = file(filename,'w')

    outputfile.write("HIERARCHY\n")

    armData = Blender.Object.Get(armaturename).getData()

    str_res = printArmatureHierarchie (armData)
    outputfile.write(str_res)
    outputfile.write("MOTION\n")
    outputfile.write("Frames: %d\n"%(endFrame-startFrame))
    outputfile.write("Frame Time: %f\n"%(1.0/Blender.Scene.getCurrent().getRenderingContext().framesPerSec()))

    ctx = Blender.Scene.getCurrent().getRenderingContext()
    Blender.Set('curframe', startFrame)
    while Blender.Get('curframe') < endFrame:
        print "frame : %d"%(Blender.Get('curframe'))
        str_res = printArmatureFrame(armData)
        outputfile.write(str_res)
        Blender.Set('curframe',Blender.Get('curframe')+1)

    outputfile.close()

    Blender.Set('curframe', startFrame)

    Blender.Redraw()

print "**** START ****"

bfilename = Blender.Get('filename')
armaturename = ""
nfilename = bfilename.replace('.blend', '.bvh')
print nfilename
obj_sel = Blender.Object.GetSelected()
if (obj_sel != None) and (len (obj_sel) == 1) and (type(obj_sel[0].getData()) == Blender.Types.ArmatureType):
    print obj_sel[0].getName()
    print type(obj_sel[0].getData())
    armaturename = obj_sel[0].getName()
    Blender.Window.FileSelector(exportBVH, 'Export BVH',nfilename)
else:
     error_txt = "Error%t|Select one and only one armature before running this script"
     Blender.Draw.PupMenu(error_txt)
     print error_txt

print "**** END ****"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 7:56 pm 
Online
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Do you have a direct link where we can download this file ? Python and copy-paste are not always best friends :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 26, 2007 5:47 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
You're right.
You should find it here: http://vicentecarro.dyndns.org/raydium/IKBaker.py
:wink:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group