Raydium 3D Game Engine https://memak.raydium.org/ |
|
Hanged ragdoll https://memak.raydium.org/viewtopic.php?f=8&t=1931 |
Page 1 of 1 |
Author: | Farabi [ Thu May 28, 2009 5:56 am ] |
Post subject: | Hanged ragdoll |
Anyone can give me a simple example about hanged ragdoll? I'd like to know how to positioned an ODE object. |
Author: | Xfennec [ Wed Jun 03, 2009 8:14 pm ] |
Post subject: | Re: Hanged ragdoll |
Doc, 45.110: void raydium_ode_object_move_name_3f (char *name, dReal x, dReal y, dReal z) You'll also find ragdoll samples in Raydium sources, with ragdoll.c and contrib/raydium-extra/ragdolls/*.c |
Author: | Farabi [ Thu Jun 04, 2009 8:01 pm ] |
Post subject: | Re: Hanged ragdoll |
I did use raydium_ode_object_move_name_3f but the other ODE element is bounching not hanged, know why this is happen? |
Author: | Xfennec [ Fri Jun 05, 2009 12:33 pm ] |
Post subject: | Re: Hanged ragdoll |
Try to post clearly, your last message is almost unreadable ... "The other ODE element" ? "hanged ragdoll" ? In short: explain what you want to do, what you're doing, and what's wrong. |
Author: | Farabi [ Mon Jun 15, 2009 3:52 am ] |
Post subject: | Re: Hanged ragdoll |
Hai xfennex Im sorry, So for make thing simpler download my app and take a look by yourself, http://omploader.org/vMXUwag/Game_Engine.zip look for a set of cubes above, I used raydium_ode_object_move_name_3f to make it stay at certain position, but if you wait for a few minutes, the position will start to change. Sorry for my last message, dont get annoyed. |
Author: | ouille [ Sun Jun 21, 2009 4:08 pm ] |
Post subject: | Re: Hanged ragdoll |
Hello, We don't really want to execute foreign exe on our working machine. So after testing on a "test" machine. You're right box are moving alone. But without source code i can't help you further. I don't know your code, what are you doing exactly ... so ... On an other thest i put a box in skel.c and it stay at the right place for long time. So perhaps monitor your calls to move_3f and verify object/element Id pos ... Have a nice day. Ouille |
Author: | Farabi [ Tue Jun 23, 2009 3:53 am ] |
Post subject: | Re: Hanged ragdoll |
The source is on MASM syntax, I hope you will be able to understand it (I know it was a bad idea to use assembler) Code: WinMain proc uses esi edi hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM invoke fRaydiumInitAll push CSTR("Farabi") push RAYDIUM_RENDERING_WINDOW push 480 push 600 call raydium_window_create add esp,16 invoke FindWindow,0,CADD("Farabi") .if eax==0 invoke MessageBox,0,CADD("Cannot Find Window"),0,0 .endif mov hwnd,eax invoke GetDC,hwnd .if eax==0 invoke MessageBox,hwnd,CADD("DC failed"),0,0 .endif mov hDC,eax invoke GetProcAddress,Raydium, CADD("raydium_texture_filter_change") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif push RAYDIUM_TEXTURE_FILTER_TRILINEAR call eax add esp,4 push CFLT(2000.0) push CFLT(0.01) push CFLT(60.0) call raydium_window_view_perspective add esp,12 invoke GetProcAddress,Raydium, CADD("raydium_light_enable") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif call eax push 0 call raydium_light_on add esp,4 ; ;void raydium_light_conf_7f(GLuint l,GLfloat px, GLfloat py, GLfloat pz, GLfloat intensity, ;GLfloat r, GLfloat g, GLfloat b) push CFLT(1.0) push CFLT(1.0) push CFLT(1.0) push CFLT(100000000.0) push CFLT(100.0) push CFLT(150.0) push CFLT(150.0) push 0 call raydium_light_conf_7f add esp,32 push 1 call raydium_light_on add esp,4 push CFLT(1.0) push CFLT(1.0) push CFLT(1.0) push CFLT(100000000.0) push CFLT(100.0) push CFLT(-150.0) push CFLT(150.0) push 1 call raydium_light_conf_7f add esp,32 push 2 call raydium_light_on add esp,4 push CFLT(1.0) push CFLT(1.0) push CFLT(1.0) push CFLT(100000000.0) push CFLT(100.0) push CFLT(150.0) push CFLT(-150.0) push 2 call raydium_light_conf_7f add esp,32 push 3 call raydium_light_on add esp,4 push CFLT(1.0) push CFLT(1.0) push CFLT(1.0) push CFLT(100000000.0) push CFLT(100.0) push CFLT(-150.0) push CFLT(-150.0) push 3 call raydium_light_conf_7f add esp,32 invoke GetProcAddress,Raydium, CADD("raydium_background_color_change") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif ;aydium_background_color_change(1,0.9,0.7,1); push CFLT(1.0) push CFLT(0.0) push CFLT(0.0) push CFLT(0.0) call eax add esp,16 invoke GetProcAddress,Raydium,CADD("raydium_fog_disable") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif call eax invoke GetProcAddress,Raydium, CADD("raydium_sky_box_cache") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif ;call eax invoke GetProcAddress,Raydium, CADD("glutKeyboardFunc") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif push offset Key call eax add esp,4 invoke GetProcAddress,Raydium, CADD("glutSpecialUpFunc") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif ; push offset KeyUp ; call eax ; add esp,4 invoke glEnable,GL_LINE_SMOOTH ;invoke glEnable,GL_LIGHTING invoke GetProcAddress,Raydium, CADD("raydium_ode_CollideCallback") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif mov raydium_ode_CollideCallback,eax push offset Collide pop dword ptr[eax] ;call eax ; invoke GetProcAddress,Raydium,CADD("raydium_ode_set_physics_freq") ; .if eax==0 ; invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ; .endif ; push CFLT(100.0) ; call eax ; add esp,4 invoke GetProcAddress,Raydium,CADD("raydium_osd_color_change") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK .endif mov raydium_osd_color_change,eax push CFLT(1.0) push CFLT(1.0) push CFLT(1.0) call raydium_osd_color_change add esp,12 invoke GetProcAddress,Raydium,CADD("raydium_camera_replace_go") .if eax==0 invoke MessageBox,0,CADD("Cannot Find function"),0,MB_OK ret .endif mov raydium_camera_replace_go,eax push CSTR("map.tri") call raydium_ode_ground_set_name add esp,4 jmp @f invoke LoadObject,CADD("anm1.tri") invoke LoadObject,CADD("anm2.tri") invoke LoadObject,CADD("anm3.tri") invoke LoadObject,CADD("anm4.tri") invoke LoadObject,CADD("anm5.tri") @@: invoke SetTimer,hwnd,1,1000,addr FPSCounter invoke fBVHReadData,CADD("Untitled.bvh"),addr fb push CSTR("obj1") call raydium_ode_object_create add esp,4 mov a,eax invoke mAlloc,256 mov obj1,eax invoke fRaydiumODEObjectBoxAdd,CADD("Hip"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,0 invoke fRaydiumODEElementMoveName3f,CADD("Hip"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fRaydiumODEObjectBoxAdd,CADD("waist"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,1 invoke fRaydiumODEElementMoveName3f,CADD("waist"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fRaydiumODEObjectBoxAdd,CADD("abdomen"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,2 invoke fRaydiumODEElementMoveName3f,CADD("abdomen"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fRaydiumODEObjectBoxAdd,CADD("chest"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,3 invoke fRaydiumODEElementMoveName3f,CADD("chest"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fRaydiumODEObjectBoxAdd,CADD("neck"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,4 invoke fRaydiumODEElementMoveName3f,CADD("neck"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fBVHGetDataS,addr fb,0,1 invoke fRaydiumODEJointAttachHingeName,CADD("waist2"),CADD("Hip"),CADD("waist"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X invoke fBVHGetDataS,addr fb,0,2 invoke fRaydiumODEJointAttachHingeName,CADD("abdomen2"),CADD("waist"),CADD("abdomen"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X invoke fBVHGetDataS,addr fb,0,3 invoke fRaydiumODEJointAttachHingeName,CADD("chest2"),CADD("abdomen"),CADD("chest"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X invoke fBVHGetDataS,addr fb,0,4 invoke fRaydiumODEJointAttachHingeName,CADD("neck2"),CADD("chest"),CADD("neck"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X invoke GetProcAddress,Raydium, CADD("raydium_callback") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif push offset DrawScene call eax add esp,4 ret WinMain endp Code: DrawScene proc LOCAL buff[256]:dword LOCAL position,t:dword LOCAL cambuff:dword LOCAL tick:dword LOCAL q:qword invoke GetTickCount mov tick,eax invoke GetProcAddress,Raydium, CADD("raydium_joy_key_emul") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif call eax invoke GetProcAddress,Raydium, CADD("raydium_key") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif mov edx,[eax] invoke GetProcAddress,Raydium, CADD("raydium_key_last") .if eax==0 invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK ret .endif mov edx,[eax] call raydium_clear_frame push RAYDIUM_CAMERA_FREEMOVE_NORMAL call raydium_camera_freemove add esp,4 ; ; push CFLT(1.0) ;z ; push CFLT(0.0) ;y ; push CFLT(100.0) ;x ; push obj2 ; call raydium_ode_element_move_name_3f ; add esp,16 ; ; push CFLT(0.0) ;z ; push CFLT(0.0) ;y ; push CFLT(0.0) ;x ; push obj2 ; call raydium_ode_element_rotate_name_3f ; add esp,16 ; ; push CFLT(1.0) ;z ; push CFLT(0.0) ;y ; push CFLT(100.0) ;x ; push obj3 ; call raydium_ode_element_move_name_3f ; add esp,16 ; ; push CFLT(0.0) ;z ; push CFLT(0.0) ;y ; push CFLT(0.0) ;x ; push obj3 ; call raydium_ode_element_rotate_name_3f ; add esp,16 ; ; push CFLT(1.0) ;z ; push CFLT(0.0) ;y ; push CFLT(100.0) ;x ; push obj4 ; call raydium_ode_element_move_name_3f ; add esp,16 ; ; push CFLT(0.0) ;z ; push CFLT(0.0) ;y ; push CFLT(0.0) ;x ; push obj4 ; call raydium_ode_element_rotate_name_3f ; add esp,16 ; ; push CFLT(1.0) ;z ; push CFLT(0.0) ;y ; push CFLT(100.0) ;x ; push obj5 ; call raydium_ode_element_move_name_3f ; add esp,16 ; ; push CFLT(0.0) ;z ; push CFLT(0.0) ;y ; push CFLT(0.0) ;x ; push obj5 ; call raydium_ode_element_rotate_name_3f ; add esp,16 ; invoke fRaydiumODEElementMoveName3f,CADD("Hip"),CFLT(0.0),CFLT(5.0),CFLT(10.0) ; invoke fRaydiumODEObjectMoveName3f,CADD("obj1"),CFLT(0.0),CFLT(0.0),CFLT(5.0) jmp @f .if frame_count==0 invoke LoadObject,CADD("anm1.tri") .elseif frame_count==2 invoke LoadObject,CADD("anm2.tri") .elseif frame_count==4 invoke LoadObject,CADD("anm3.tri") .elseif frame_count==6 invoke LoadObject,CADD("anm4.tri") .elseif frame_count==8 invoke LoadObject,CADD("anm5.tri") mov frame_count,0 .endif inc frame_count push CFLT(-0.7) push CFLT(0.0) push CFLT(1.0) push obj1 call raydium_ode_element_move_name_3f add esp,16 push CFLT(0.0) ;z push CFLT(0.0) ;y push CFLT(0.0) ;x push obj1 call raydium_ode_element_rotate_name_3f add esp,16 @@: push 0 call raydium_ode_draw_all add esp,4 call raydium_camera_get_data mov cambuff,eax invoke glDisable,GL_LINE_SMOOTH mov eax,cambuff push FLT2INT(dword ptr[eax+4*3]) push CSTR("Rot X: %d ") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(98.0) ; Y push CFLT(20.0) ; X CALL raydium_osd_printf add esp,28 mov eax,cambuff push FLT2INT(dword ptr[eax+4*4]) push CSTR("Rot Y: %d ") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(95.0) ; Y push CFLT(20.0) ; X CALL raydium_osd_printf add esp,28 mov eax,cambuff push FLT2INT(dword ptr[eax+4*5]) push CSTR("Rot Z: %d ") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(92.0) ; Y push CFLT(20.0) ; X CALL raydium_osd_printf add esp,28 mov eax,cambuff ;GLfloat x, GLfloat y, GLfloat size, GLfloat spacer,char *texture, unsigned char *format, ...) push FLT2INT(dword ptr[eax+4*0]) push CSTR("posX: %d") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(98.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 mov eax,cambuff push FLT2INT(dword ptr[eax+4*1]) push CSTR("PosY: %d") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(95.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 mov eax,cambuff push FLT2INT(dword ptr[eax+4*2]) push CSTR("PosZ: %d") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(92.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 push tick_c push CSTR("Time Call: %d ms/Frame") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(87.0) ; Y push CFLT(20.0) ; X CALL raydium_osd_printf add esp,28 mov eax,raydium_render_fps push dword ptr[eax] pop FPS push FPS push CSTR("%d FPS") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(82.0) ; Y push CFLT(20.0) ; X CALL raydium_osd_printf add esp,28 invoke fBVHGetDataS,addr fb,0,0 pushad mov eax,[eax].fObject.lpName push eax ; push FLT2INT([eax].fObject.PositionZ) ; push eax push CSTR("Name: %s") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(83.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 popad pushad fld [eax].fObject.RotationX fstp q invoke FloatToStr2,q,addr buff lea eax,buff push eax ; push FLT2INT([eax].fObject.PositionZ) ; push eax push CSTR("Test Value X: %s") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(78.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 popad pushad fld [eax].fObject.RotationY fstp q invoke FloatToStr2,q,addr buff lea eax,buff push eax ; push FLT2INT([eax].fObject.PositionZ) ; push eax push CSTR("Test Value Y: %s") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(73.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 popad pushad fld [eax].fObject.RotationZ fstp q invoke FloatToStr2,q,addr buff lea eax,buff push eax ; push FLT2INT([eax].fObject.PositionZ) ; push eax push CSTR("Test Value Z: %s") ; format push CSTR("Font2.tga") ; texture push CFLT(0.5) ; spacer push CFLT(18.0) ; size push CFLT(68.0) ; Y push CFLT(1.0) ; X CALL raydium_osd_printf add esp,28 popad invoke glEnable,GL_LINE_SMOOTH call raydium_rendering_finish invoke GetTickCount sub eax,tick mov tick_c,eax inc FPS_C ;invoke Sleep,40 ret DrawScene endp Code with ";" in front of it is not used code, ";" mean is comment or equal to "/* */" on C++. Keep up the good works to all of you guys. |
Author: | ouille [ Thu Jun 25, 2009 8:42 pm ] |
Post subject: | Re: Hanged ragdoll |
Ouch assembler !!!!! I've quickly looked at your code, i don't see where the trouble is. Try to narrow your code with only to objects ? And add others one slowly (like for cooking). Perhaps anchors of your joints are on object specific part ? Try to decrease time step, or tweak erp and cfm (world) value. I can't help more further sorry. Have a nice day. Ouille. |
Author: | Farabi [ Sun Jun 28, 2009 7:18 am ] |
Post subject: | Re: Hanged ragdoll |
This is how I move the join and attach it Code: invoke fRaydiumODEObjectBoxAdd,CADD("Hip"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,0 invoke fRaydiumODEElementMoveName3f,CADD("Hip"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fRaydiumODEObjectBoxAdd,CADD("waist"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri") invoke fBVHGetDataS,addr fb,0,1 invoke fRaydiumODEElementMoveName3f,CADD("waist"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ invoke fBVHGetDataS,addr fb,0,1 invoke fRaydiumODEJointAttachHingeName,CADD("waist2"),CADD("Hip"),CADD("waist"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X invoke fBVHGetDataS,addr fb,0,2 invoke fRaydiumODEJointAttachHingeName,CADD("abdomen2"),CADD("waist"),CADD("abdomen"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X And here is the code for moving it Code: fRaydiumODEObjectMoveName3f proc uses esi edi lpName:dword,lpX:dword,lpY:dword,lpZ:dword push lpZ push lpY push lpX push lpName call raydium_ode_object_move_name_3f add esp,16 ret fRaydiumODEObjectMoveName3f endp Quote: Perhaps anchors of your joints are on object specific part ? Yes it is. For example, If I have 2 object positioned at 0,0,5 and 0,0,10 the anchor is at 0,0,5 is that are not allowed? Quote: I can't help more further sorry. No problem, Im just need to make sure that there is nothing wrong on the dll and the mistake is on my own. And that is helpfull enough. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |