ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator Mesh maths
person icon
freddy
Registered User
Quote
2014-09-12 19:39:53

I thought it best to keep this separate to my other question.

In my morphing I have to calculate the difference between the same two vertex positions in two models. One model is the morph target (morphMeshBuffer) and the other is a neutral model (neutralMeshBuffer). At the moment I am trying this :


var xDif = (morphMeshBuffer.Vertices[v].Pos.X - neutralMeshBuffer.Vertices[v].Pos.X) * weight.toFixed(4);
var yDif = (morphMeshBuffer.Vertices[v].Pos.Y - neutralMeshBuffer.Vertices[v].Pos.Y) * weight.toFixed(4);
var zDif = (morphMeshBuffer.Vertices[v].Pos.Z - neutralMeshBuffer.Vertices[v].Pos.Z) * weight.toFixed(4);


So xDif, yDix and zDif should all then hold the difference between the two mesh's positions for that vertex (v).

weight is simply the weight of the morph - ie if it's having no influence it would be 0 and therefore xDif, yDif and zDif would be 0. All the way up to weight of 1 which would see xDif, yDif and zDif having some value.

This is more or less the same way I do it in c-sharp, but my results are strange. Perhaps I am doing the calculation wrong for CopperLicht ?

Cheers :)

person icon
niko
Moderator
Quote
2014-09-13 05:49:06

Sounds ok to me. But if it doesn't work it could be that the reason for this is the problem you described in the other thread.

person icon
freddy
Registered User
Quote
2014-09-13 15:34:38

That's what I thought, the maths seems fine. Thanks again for the help.

person icon
freddy
Registered User
Quote
2014-09-13 18:29:03

Just to confirm that this works as expected.

It was the createClone() function that was causing the problem and that has now been fixed :)


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |