Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 945 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 7 of 41 1 2 5 6 7 8 9 40 41
Re: Newton 2 wrapper [Re: VeT] #225528
09/04/08 23:31
09/04/08 23:31
Joined: Oct 2006
Posts: 36
BigM Offline
Newbie
BigM  Offline
Newbie

Joined: Oct 2006
Posts: 36
I am using the user input to move a corkscrew joint. This worked in 1.53; I'm not sure it works with 2.0 - a lot other bugs popped first and I haven't been able to properly test this part.

I haven't looked up whether joint specific functions like NewtonCorkscrewGetJointVeloc are the same in 2.0 or if the callback is still passed a NewtonHingeSliderUpdateDesc argument.

Initialization of the corkscrew joint elements:
Code:
thing = ent_create("model.mdl", vector(0, 1, 1), NULL);
nthing = newton_addentity(thing, .05, NEWTON_CONVEXHULL, NULL);

joint = NewtonConstraintCreateCorkscrew (nworld, vectorf(0, QUANTTOMETER*1, QUANTTOMETER*1), vectorf(1, 0, 0), nthing, NULL); //no need for an actual second body
NewtonCorkscrewSetUserCallback(joint, movement_callback);

In the user input loop in main:
Code:
sensitivity = 0.005; //this is used to scale the mouse movement to acceptable velocities.
actual_velocity = NewtonCorkscrewGetJointVeloc(joint);
target_velocity = mickey.y * sensitivity /(time_frame/16) //mickey.y is given by the engine
acceleration = (target_velocity - actual_velocity)/(time_frame/16)

In callback:
Code:
movement_callback (const NewtonJoint* joint, NewtonHingeSliderUpdateDesc* desc){
  desc[0].m_accel = acceleration; //the NewtonHingeSliderUpdateDesc struct was provided, as is, by the wrapper in 1.53
  retCode |= 1; //or with 0x01 to tell newton this axis is active. Don't know if it is still required in 2.0
}


Hope this clears things up! Anyway, the concept of using PROC_LATE does not depend on any actual implementation of user input processing or callback code: time_frame values used in main and in callbacks will be different if there is a screen update in between.

The slicing woks exactly as you re-wrote, but don't cast advance as an 'int'; it must be a 'float'. The objective is that you gain control of how many times Newton is updated and how long the slices are. The NewtonSetMinimumFrameRate function let you set the same limit; however, in my case, it turned out that the several sub-splittings automatically made by the newton engine would not add up to the passed update time, and so I created my own slicing.

Re: Newton 2 wrapper [Re: BigM] #225878
09/06/08 14:32
09/06/08 14:32
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
I have seen you are using "ent_getmatrix" in the script, but i have no idea where this function is defined?


MfG, Christian__A. Visit my Site: www.chris-a.de


Re: Newton 2 wrapper [Re: Christian__A] #225950
09/06/08 21:05
09/06/08 21:05
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Christian__A, in matrix.c, try to use Ctrl+Shift+F to search in folder wink

BigM, i'd try this in nearly half of hour smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #225980
09/07/08 00:10
09/07/08 00:10
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
v.9
- updated to Newton 2.17
- updated onsetdestructor
- added example of safely removing of body on level map10(if you press X, sphere deletes)
- added pause of Newton on key_P
- found and fixed error in NewtonAPI2.16.c (after converting to NewtonAPI2.17.c, fixed in both)
- working on compound collition(map50)
- working on magnets(map15)


BTW, there were 12 template versions (8.1 - 8.12)


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #226011
09/07/08 09:59
09/07/08 09:59
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
BigM, your example crashes in callback... (retCode is commented as no need),but i understood your idea smile
i'd try to add "force mouse" that would allow user to move physical bodies


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #226019
09/07/08 11:14
09/07/08 11:14
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
oops, i found bug in v.9, so i decide to wrap quickly one of the simplest examples, but with comments in every step


v.10
- found bug in map11 with uncorrect action name, fixed
- added map16 - Customizing Sphere(step-by-step creation of body) - espeshially for beginners wink

yes, i forgot to say that i wouldn't going to wrap levels like "tower" or "pyramide" as they are usefull only as demonstration of NewtonPlayGround, i dont think that they include nessesary and new info for users... but if somebody wants to see level like this in Gamestudio, you can write to me smile


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #226037
09/07/08 14:28
09/07/08 14:28
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
Great, i'm just downloading the your new version.


MfG, Christian__A. Visit my Site: www.chris-a.de


Re: Newton 2 wrapper [Re: Christian__A] #226084
09/07/08 20:39
09/07/08 20:39
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
you're wellcome, i'm waiting for bugs report wink


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Newton 2 wrapper [Re: VeT] #226140
09/08/08 07:38
09/08/08 07:38
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
No real bugs found until now smile But i've tried to get the vehicle-functions from the joint-lib working (which should not be a realy problem as the header is Lite-C-friendly). I'm creating a CustomJoint with CreateCustomMultiBodyVehicle, but as soon i try to add wheels with CustomMultiBodyVehicleAddTire, the vehicle body disapears. I've postet this problem also in the newton forums as i don't think it is a problem with the wrapper: http://newtongamedynamics.com/forum/view...8c4620e122e1652


MfG, Christian__A. Visit my Site: www.chris-a.de


Re: Newton 2 wrapper [Re: Christian__A] #226159
09/08/08 09:42
09/08/08 09:42
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
i'm planing to end with magnet, buoyancy and compounds and would go to joints smile
i answered to your topic

btw, look here, maybe this would help
http://www.newtondynamics.com/forum/viewtopic.php?f=9&t=4612


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Page 7 of 41 1 2 5 6 7 8 9 40 41

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1