View on modell

Posted By: Progger

View on modell - 11/20/11 11:25

Hi community
I need your help
I try to get a view on a model but it still dont work frown
I searched in the aums and found a script but this only works on sprites how can ic chnage it that it works on models also ?

Code:
Q: Is it possible to render a view on a target like a model, a texture or a bmap? I'd like to use that as a mirror, for example.

A: Sure, take a peek.

 

ENTITY* mirrorsprite;

 

VIEW* mirror_view;

 

action mirror_sprite() // attach this action to a sprite / model that will be used for the mirror

{

       mirrorsprite = my;        

       set (my, PASSABLE | DECAL);

}

 

function mirror_startup()

{

       while (!mirror_sprite) {wait (1);}

       mirror_view = view_create(10); // set the layer value for the new view to 10

       wait (2);

       set (mirror_view, SHOW);

       mirror_view.size_x = 128;

       mirror_view.size_y = 128; // the mirror sprite has 128x128 pixels

       mirror_view.bmap = bmap_for_entity(mirrorsprite, 0);

       vec_set(mirror_view.x, vector(1000, 500, 100)); // set the position of the mirror "eye"

       vec_set(mirror_view.pan, vector(0, -10, 0)); // set the angles of the mirror "eye"

}



When i apply this to a model nothing changes you can not see a view on it.
When i use a sprite it works perfectly
Can you explain me from step to step how to do that.
How many skins shell the model have?
Because i think iam doing something wrong


I really need your help!!
Thanks for reading this and also for your help laugh
WFG Progger laugh
Posted By: Progger

Re: View on modell - 11/20/11 18:49

Sorry for doublepost but i want to know it to go on with development of the game laugh
WFG Progger laugh
Posted By: 3run

Re: View on modell - 11/20/11 18:55

PM me dude, I have something for you wink
Posted By: EvilSOB

Re: View on modell - 11/21/11 01:45

Firstly, I would suggest using ent_getskin(mirrorent,1) rather than bmap_for_entity.
I have had far more success using it, its just far more reliable.

Secondly, if it is working on a sprite for you, why not use it into an
ent_decal? Paste the decal onto your entity, an it would work the same I believe.

Thirdly, if ent_decal dont work, or is un-do-able, I BELIEVE you will need two skins
on your model.
Skin1 is the models general texture, and skin2 a 128x128 texture mapped
entirely onto the 'reflective' portion of the model.
Oh, and use 'bmap=ent_getskin(mirrorent,2)' in the view.

See if that can get you started. It will take a bit of tweaking to get it
looking right I believe.
But what Ive given you should get at least some of the view mapped into the model.
Posted By: Progger

Re: View on modell - 11/22/11 15:22

Thank you very much EvilSOB
Ill try all tipps u gave me laugh
ent_getskin also dont work
now ill try to use decals laugh
Hope that will work
WFG PRogger laugh
Posted By: EvilSOB

Re: View on modell - 11/22/11 15:39

Looking forward to your results...
Posted By: Progger

Re: View on modell - 11/24/11 21:43

So sorry for not posting but i had to do much to do in school.
Well then first i want to thank you all laugh
I did a big mistake in my code so itcould not work^^
Well thanks to all who helped me and especially to 3run who made an example for me so i could compare both codes and finally found the error.
Here is the picture:


WFG Progger laugh
© 2024 lite-C Forums