TL:DR version: I figured out how to make a Flasher object always face the player, as well as take into account the the size of the object (usually a primitive) so it doesn't clip into the object, it always "rotates" around it.
One of my driving forces for VP, when I go in to make modifications to tables or the rare cases where I try to make my own table, is to make it angle independent. Since Primitives have been allowed in VP, this is now very attainable (unfortunately it trades the skills of perfect placement and source material matching with 3D modeling skills). Take for instance the most recent Scared Stiff table (uploaded by Dozer316, it's a mod of JPS's).
Ridiculously amazingly looking table, but hardly any (if any) meshes. I hold no fault to the authors; a mesh looks only as good as its texturing. And since you can get photo-realistic with ramps and walls (since they're literally photos), it would take a crazy 3D artist (or maybe a... Dark minded one... see what I did there ;-)) to get that level of realism. However, the player is limited to the angle the author chose. If they want to change the angle to suite their desires more, they break the realism, and things can start looking mighty funky.
I looked at Scared Stiff because some amazing authors have created it in FP, which means lots of already made and textured meshes that I've easily been porting over to VP for my own use. Now I admit, I'm not a fan of flashy flashers. I mean, when I play a table and a flasher goes off, I don't know about anyone else, but I don't see a star burst, or flare effect. But it's admittedly cool to see on the screen, so for the sake of not re-doing all the graphics, I'm keeping the flashers (for now).
As of this writing, I've replaced all the spines, the beast's head, all the leapers, the two boogie monsters, and the four boney flasher holder things. I've animated the leapers (using code that I'll swap out into my Cactus Canyon table instead of using a ball to mimic physics), which I'm proud of. I've "animated" the boogie men (not really animated (yet), just tilting, but it looks no worse than the current iteration... although the meshes don't look that great). BUT, that's not the point of this post, that's just me bragging. The point of the post is that I think I've figured out a way to tilt the flashers towards the player, regardless of the Backdrop settings.
Currently the flashers are flat, so the lower you make the inclination, the flatter the flasher effect is and the more unrealistic it looks. However, if you put the following code in the table init (or anywhere outside a Sub I suppose), it'll face the flashers towards the player regardless of the Backdrop settings:
FlasherName.RotX = -TableName.Inclination FlasherName.Y = (dSin(TableName.Inclination)*SizeOfPrimitive) + PrimitiveName.Y FlasherName.X = PrimitiveName.X FlasherName.Height = (dCos(TableName.Inclination)*SizeOfPrimitive) + PrimitiveName.Z
Yeah, four lines of code, per Flasher. Please Note, dSin and dCos are standard functions that take the radians that VBScript gives from a Sin/Cos function and turns it into degrees (which is what we need here); so you need to include that somewhere else in the code. I can copy it here if anyone is interested.
The first line of code rotates the Flasher so it's always facing the player, but, this will cause it to clip into the object. We've got to move it's Y position and Height so it stays on the outside of the primitive (which is why we need to know the size of the primitive).
The second line of code moves the Y based on the inclination of the table and the size of the primitive, offset by the location of the primitive.
The third line isn't really needed, but I included it for robust-ness. This line lets you not have to worry about lining it up in the editor.
The fourth line does the same as the second, but acts on the Height. Here's an example from the Scared Stiff table I'm working on:
Flasher24.RotX = -Table1.Inclination Flasher24.Y = (dSin(Table1.Inclination)*75) + Primitive33.Y Flasher24.X = Primitive33.X Flasher24.Height = (dCos(Table1.Inclination)*75) + Primitive33.Z + 125
The red balls of the flasher on the table are about 75 VP units big, and it sits about 55 units higher than the Origin of the mesh which is already at 55 (so 55 units from the bottom of the holder to the bottom of the ball, then another 75 units to the top of the ball = 125 units offset). The position of the primitive is (35, 1503). Let's say you put the inclination at 5 degrees, that means:
Flasher24 will be rotated to -5
Flasher24's Y position will be dSin(5) * 75 + 1503 = 1509.54
Flasher24's X position will be 35
Flasher24's Height will be dCos(5) * 75 + 55 + 125 = 254.71
Now let's say you put in an inclination of 85, that means:
It will be rotated to -85
The Y will be dSin(85) * 75 + 1503 = 1577.71
The X will be the same
The Height will be dCos(85) * 75 + 55 + 125 = 186.54
Is anyone interested in this? I know the code isn't 100% perfect, but it works on this table at least.




Contributor
Top






















are all trademarks of VPFORUMS.