Jump to content

Digiverse

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Digiverse

  1. Thanks for the suggestions, they were very helpful. Hiding each child mesh belonging to the entity seems to work well and doesn't affect the physics processing as required. I've now created an EntityVisible( TEntity, bool ) function for making objects invisible or visible. In the function I loop through the child entites and for every mesh found using GetEntityKey( child, "class" ), I call HideEntity or ShowEntity on the mesh.
  2. Hi, How can I make an entity temporarily invisible, but still active in the physical world? The HideEntity function makes an object disappear, but also stops its physics processing. All I want to do is to be able to make an Entity invisble or visible at will, without interferring with its physics or collision tests. The best solution I've come up with is to make the worlds near view range zero and when I want to hide an object set its view range to Near and back to Medium again when I want to show it. That works quite well but objects still appear when very close to the camera (even with camera near range at 0.1). I feel there must be a simpler and more effective way of removing an entity from the rendering process? Thanks!
  3. I'd love to know what functions you used to achieve this effect. I can work out the speed and turn angles easily enough, but I dont know how to physically change the traction. SetBodyFriction doesn't seem to have any effect for me, is that what you are using? I got some quite interesting effects using SetBodyOmega by forcing oversteer in similar circumstances. It needs a lot of tweaking and I just wonder how others are achieving the effects of low grip and oversteer in their games.
  4. I think one of the main issues with the vehicles is the amazing grip levels they have. It seems impossible to spin a car in Leadwerks due to oversteer. I have seen other non-Leadwerks vehicle demos using Newton that implement more realistic vehicle behaviour by allowing control over individual tire friction and max grip levels. Are we able to fine-tune our vehicles in this way by controlling friction and grip levels of individual tires? I've tried using SetBodyFriction() on the vehicle chassis to set a generic friction level, but even that seems to make no difference - presumably because the vehicle model isnt in contact with the terrain (the wheels are). It would be great to be able to modify individual tire grip levels in real time but I fear these commands are not supported in Leadwerks (or am I missing something?). I hope someone can point me in the right direction... no pun intended! Thanks.
  5. Thanks for your replies. My main reason for wanting to utilise Lua scripts for the basic setup and properties of the vehicle was so I could make quick changes during testing within the Editor environment and use the same script in my main c++ game. I was previously setting up my vehicle completely in C++, but it meant I wasn't easily able to use the same vehicle in the Editor (without copying the code into a lua script). I've still not found a way of accessing the TVehicle reference in C++ of a car made in Lua, but I've got around it quite well for now by doing everything that needs the TVehicle in the script and everything else in C++. In a way its quite nice because it keeps the creation and use of the vehicle seperate. Theres actually something quite satisfying about passing in throttle and steering commands from C++ into a car script and having the game control the car. I'm far more comfortable with C++ than Lua though and this only works for me at the moment because the code required in the car script is relatively small, so it maybe that long term I transfer it all back into C++ if I end up needing to access the TVehicle more, but the process has certinaly help me to learn Lua a bit.
  6. Some game scripts refer to an objecttable in order to get additional info from an object created in its script. chassis=LoadModel("abstract::monstertruck.gmf") carobject=objecttable[chassis] car=carobject.vehicle In the above drive.lua game script, a monstertruck is being created in its own monstertruck.lua script when the gmf model is loaded and we can use the objecttable to get a reference to the vehicle object that was created in the monstertruck script. However, I'm a bit lost as to how I would get this vehicle object reference if I were to not have a game script but be running the game in C++. I could still use chassis=LoadModel("abstract::monstertruck.gmf") in my C++ game, but how could I get a reference to the vehicle object that was created by CreateVehicle in the monstertruck.lua? Sorry if this is basic stuff, but I'm a bit stumped! Thanks
  7. Thanks for your feedback. Adding a raycast into the collision callback actually seems to give pretty good results, as follows: const float raycast_length = 0.1f; TPick pick; LinePick( &pick, collision_pos + ( collision_normal * raycast_length ), collision_pos - ( collision_normal * raycast_length ) ); Using the known collision coords and the collision normal, I apply a raycast from just before to just after the collision point. This seems to fill a TPick with the required info from which I can get the surface and texture name. It may not be a solution that suits every project, but it seems to be working quite well for me at the moment in determining whether my vehicle is on the road, grass or in a wall
  8. Hi Roland, thanks for your reply. Maybe I'm misunderstanding what constitutes as an Entity in the engine. My understanding up to now is that if I create a 6-sided cube and texture each side of the cube a different material and export it as a single gmf, I can then load this in game as a single Entity. So how does GetEntityMaterial(entity) know which side of the cube I'm talking about as they all have different textures?
  9. Hi, I'm loving Leadwerks, just wonder if someone can point me in the right direction with this problem... Is there a way of obtaining the texture name that has been hit in a collision (in C++)? I'm using the collision callback function and I'm aware this can identify the entities involved in a collision as well as the collision point. However, I need to be able to find out which material has been hit in the collision, but I can't find a way of obtaining this info from the collision callback. At the moment my level is essentially one large entity (one gmf) comprised of many submeshes with different materials. One non-programming solution would be to break down my geometry into seperate entities, so I'd know which material would be being hit because each entity would only have one material. But before I resort to that, I was hoping to be able to get the necessary info from code. Is the only way to get such info to perform a raycast after a collision has been found, perhaps from the point of collision in the direction of the collision normal, or something? I could get surface info from a TPick then, but it doesnt sound like an ideal of doing it. Maybe there's an easier way? Alternatively, is there a way of breaking up a large entity in Leadwerks into seperate entities in code, rather than manually exporting seperate ones in a 3D modelling app? In other words, can Leadwerks distinguish between submeshes within an entity and create new entities from them? Thanks in advance for your help with this!
×
×
  • Create New...