Quote Originally Posted by ize
Hi there. Well don't i feel like the prize idiot - i ran off at 1000 mph ... in completely the wrong direction I came online last night to upload the 2nd version and saw your post that it wasn't right. So went back to the drawing board and studied the video for about 10mins frame by frame to see exactly what it did.

After much head scratching/headaches/nosebleeds i think i have what you're looking for!

Sorry, no source at the mo because it's in such a mess after being ripped to shreds! All the materials are embedded in the app, but they can easily be loaded at runtime, etc. There's also no need to have the variations like i've done - you can have one "template" material, assign it to the phase and then make changes to the phase material leaving the original untouched.
The only thing i couldn't get right was the highlighting of the phaser. I think the best "cheat" would just be to put it in the texture. I'm no artist so i didn't try it.

I can give you an outline of how i achived it though. It's probably wrong as i'm not a maths genius. It involved a LOT of trial and even more errors

  • I calculated the direction from the camera to the first node in the phase and did a cross product of that with the phaser direction to give me the final vector (eye vector).
  • After that i calculated the angle of the phase direction and eye vector using the phase up vector as a reference. This angle returns -1 .. 1 which i changed to 0 .. 2 and made it signed so i know which side it was on -=left +=right
  • Finally i used this number to modify the uv tex coords to "slide" the texture around the phaser


Here ya go:
video: http://izeinfinity.comoj.com/flash/test2.html
Download app

Let me know if this is at least in the right direction

laters
This is awesome, it is perfect! you did a most awesome thing, exactly what i need to finish my phasers i can finally move the project forward now with weapons fully charged can't wait for the src i remember i mentioned paypal on first page, i'll be gladly donating something if you wish

The only thing i couldnt figure out is how to load a custom texture in the app.

User137: thanks for helping, i realise that ize came up with a working solution now, but i still appreciate your help, unfortunately i'm not that good with math to understand half of it, i usually go around trial and error with such complex things, in this phasers case.. it didn't quite work..