Jump to content

  • Log In with Google      Sign In   
  • Create Account

Scourage

Member Since 29 Jan 2000
Offline Last Active Apr 29 2016 04:25 PM

Posts I've Made

In Topic: Object reference not set to an instance of an object

20 April 2016 - 01:24 PM

So the problem is that you are expecting the elements of the array to be there, but they're not.  You're only allocating the space for the elements in your array, you then need to put something there.  

PlanetDetails[] Planet = new PlanetDetails[10];
for(int i=0; i<10;i++)
  Planet[i]=new PlanetDetails();

Cheers, 

 

Bob


In Topic: Thoughts on the Boost.Build system? (as opposed to CMake?)

14 April 2016 - 10:48 AM

I use CMake for work, but I've been using premake (https://premake.github.io/) for personal projects and have been slowly introducing it at work.  Premake uses Lua as it's configuration language.  I find it much easier to work with than CMake, especially when writing functions to do something complicated. 

 

To answer your original question: when I was looking for alternatives to CMake, I tried bjam, but didn't find it very user friendly.  I had used scons for a long time when working on Blender, so I knew that wasn't what I was looking for.  I stumbled onto premake and it just worked out really well for me.

 

cheers, 

 

Bob


In Topic: Engine RPM and wheel angular velocity

24 March 2016 - 02:07 PM

 

BoredEngineer, 

 

Thanks for the link, that's a good article. 

 

Cheers, 

 

Bob


In Topic: Engine RPM and wheel angular velocity

24 March 2016 - 01:29 PM

I would make engine RPM be some function of fuel flow or normalized throttle input.  Maybe something linear where 0 throttle = 500rpm (idle) and a throttle of 1.0 = 5000rpm.  You could then convert RPM to torque using some kind of mapping function, maybe use a datafile that defines the graph so you can have different types of engines.  Here's an example image that I found showing RPM -> torque

 

MU-X+torque_curve.png

 

Once you have a torque value from your rpm value, then you need to apply your "transmission." Based on the current gear, maybe it's in reverse, you get a wheel revolution speed out of it and use that value to move your model.  To implement a clutch, you would have a function before your transmission that could simply either pass through the torque value or pass a 0 when the clutch pedal is pressed.

 

I'm sure I'm missing a bunch of things, but does that help answer your question?

 

cheers, 

 

Bob


In Topic: Embedding Lua in C# with P/Invoke

25 February 2016 - 03:51 PM

So the problem is that in Lua 5.3 lua_pcall is a macro, not a function.  You need to write a function that calls lua_pcallk (notice the K at the end).  I wrote mine like this: 

 

      [DllImport(LUA_DLL, EntryPoint = "lua_pcallk", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
      public static extern int lua_pcallk(IntPtr state, int nargs, int nresults, int errfunc, IntPtr ctx, LuaContinuationFunction k);


      public static int lua_pcall(IntPtr state, int nargs, int nresults, int errfunc)
      {
         return lua_pcallk(state, nargs, nresults, errfunc, IntPtr.Zero, null);
      }

There were quite a few changes in the API from 5.1 to 5.3.

 

cheers, 

 

Bob


PARTNERS