math & physics
anddos at November 18th, 2008 13:27 — #1
say i want to create a smash effect on my model , i am stuck on how i would change the vertex buffer ,x,y,z , i know how to get the current values , i just dont know how to apply new values so the mesh looks diferent
starstutter at November 18th, 2008 13:31 — #2
sorry, don't have time currently to give a long response, but you can modify the information in the same fashion as you would with an array of pointers.
for (every vertex)
ver.position = whatever you want it to be;
EDIT: keep in mind this isn't the only way though. If you're using SM 3.0 you can create damage effects in the vertex shader. IMO it's much more straight forward and faster.
anddos at November 18th, 2008 13:52 — #3
yes but how does that know to apply it after all you only retrieve the postions , and it dosent feel like if i changes those values its not going to set them
reedbeta at November 18th, 2008 14:28 — #4
No, locking the vertex buffer means you get a pointer to the actual, real data. It is not just a copy of it and if you change the data, it will change what is rendered.
anddos at November 18th, 2008 14:33 — #5
ahh right , i see why its not made any effectr on the teapot , but i think it will work on a .x ,
so if i load a terrain .x intersect with it , i would need to only get the 3*x,y,z the mouse is over, then if i press mouse 1 i would increment the data on y axis to make the terrain heigher
starstutter at November 18th, 2008 14:37 — #6
You know, I just realized. If you're using a mesh with a vertex format you don't have access to, you're probably not locking it with the correct vertex structure. The structure "ver" must be the same size and order as the meshes vertex format, if it's not accurate, the lock will fail.
EDIT: well, it doesn't necessarily have to fail, but the right information will not be accessed.
anddos at November 18th, 2008 14:46 — #7
ive the correct values , i just cant set new values to teapot
anddos at November 18th, 2008 15:02 — #8
do i set the taken vertices points from locking and i put them in this function then? , i want to test which triangle in a mesh the ray intersects