The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.27 (Linux)
|
Vehicle Activated Signs - VAS - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4) +--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9) +--- Thread: Vehicle Activated Signs - VAS (/showthread.php?tid=995) |
Vehicle Activated Signs - VAS - lino - 09-22-2008 Hello, I am Lino and I am interested in using vdrift for making a simple educational demo. I would like to put on one of the vdrift tracks a sort of "Vehicle Activated Signs - VAS" http://www.surreycc.gov.uk/SCCWebsite/sccwspages.nsf/LookupWebPagesByTITLE_RTF/Vehicle%20Activated%20Signs%20-%20VAS?opendocument that is something that, when the car is near, displays some message like "slow down" or the current speed of the car. I am new in vdrift and I am wondering about the correct method to do this. I think that the best method would be to modify an existing track to put the VAS and then to add some code to the engine to modify this sign (maybe putting some texture over it) when the car is near. Another option would be to draw the entire sign in code, using simple OpenGL primitives. The sign hasn't to be very realistic, only a demonstration. What can be the correct way of doing this? Or can you suggest me an alternate way? Thanks a lot, Lino Re: Vehicle Activated Signs - VAS - joevenzon - 09-23-2008 lino Wrote:I think that the best method would be to modify an existing Since this is just for the purpose of a demo, I think the best approach would be to model the sign in blender, export it to .joe format, and then add code to VDrift that draws the model at hard-coded coordinates for a specific track. For the texture, create a texture for the sign inactive and a texture for the sign active, and switch between them based on how close the car is, how fast it's moving, etc. The classes you'll need to use are in texture.h, model_joe03.h plus model.h, and scenegraph.h. The basic approach to drawing an object is to, once at loading time: * create a MODEL_JOE03 object * call the MODEL_JOE03::Load() function with your model's path * create two TEXTURE_GL objects, one for the active sign and one for the inactive sign * call the TEXTURE_GL::Load() functions with your texture paths (you actually create a TEXTUREINFO class with information about the texture you want to load and pass it to the Load function) * call SCENENODE::AddNode() on the game's top-level SCENENODE object, and store the pointer you get * call SCENENODE::AddDrawable() on your scenenode pointer, and store the pointer you get * set up the DRAWABLE pointer with your inactive diffuse texture and your model * set up the transform (via SCENENODE::GetTransform()) on your scenenode pointer to move the object to where you want it to be drawn Then, every frame, check to see if the conditions are there to activate your sign, and then just use DRAWABLE::SetDiffuseMap() on your drawable pointer to switch to the active texture. Hopefully that will get you started. - lino - 09-23-2008 Thanks a lot for your suggestions. It seems straightforward, and I have something to work on. Thanks again. Lino - joevenzon - 09-23-2008 No prob, let me know if you have any questions. - lino - 09-24-2008 Hello, I have a doubt regarding this point: " set up the DRAWABLE pointer with your inactive diffuse texture and your model " I see that the DRAWABLE class has a method to set the texture, but no method to set the model (at least not directly). It seems to me that I have to create an OBJECTNODE and then tells it that it is connected to the DRAWABLE created. And this object node will be appended to the OBJECTS list in the game. Is it correct? Lino - joevenzon - 09-24-2008 lino Wrote:I see that the DRAWABLE class has a method to set the texture, but no method to set the model (at least not directly). The way you do it is by doing: mydrawable->SetToList(mymodel.GetDrawList()); You shouldn't need to use anything from the objects class with the method I described. - lino - 09-25-2008 Thanks a lot! It is working Now... just to put the sign along the road can I use the coordinates in file roads.trk to put it? For now I have used the start position 0 = 133.939041,0.094504,26.078156 in file "track.txt" (of jerez88) to put the model near the starting position of the car (so I don't have to play to see if it is working...). .... Another thing: to have the current speed of the car I have found that probably I should ask the speed of the "chassis". Is it correct? In any case thanks a lot. Lino - joevenzon - 09-25-2008 To get the car's position you can put a debug printout inside a function like VAMOSWORLD:rawHUD(): Code: Vamos_Geometry::Three_Vector position = current_focus->car->chassis().position(); If you look at VAMOSWORLD:rawHUD() for example you'll see how the speed is queried: Code: float kph = Vamos_Geometry::m_s_to_km_h (current_focus->car->chassis().cm_velocity().magnitude()); Sounds like things are progressing quickly with your demo! Nice work. - lino - 09-25-2008 Yes, thanks a lot. Sorry to disturb you, but I have a little doubt regarding texture. Should I apply them in Blender, or can I have a simple object in blender and export it, and then I apply a texture? I say this because when I export the model the script says: "I don't have any UV" So I suppose that I must create an UV map in blender first. Is this correct? I say this because I write: drawable.SetDiffuseMap(texinfo); and the model has not the texture! Or it is completely of one color or it is invisible (transparent). Sorry to disturb you, but I think this is the last question!!! (then of course I will post some screenshots of this demo...). Lino - lino - 09-25-2008 I think I have answered myself: there is a good tutorial at http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/UV_Map_Basics I have succeed in put a icosphere with the earth texture in front of the car! Well, not very exciting but it works. Next step will be to have two textures. Lino - lino - 09-26-2008 Hello. I am doing the demo and I have found that I needed a "scale" factor in the SCENETRANSFORM class. I have done this following patch: Code: diff -r 711d51ab2958 -r 552b4b4e8efa include/scenegraph.h In this mode I can have only one joe object and I put in the list the position, rotation and scale. Just for the demo purpouses it is good. Now I am collecting some beautiful textures... |