# Problems with triangle generation

I am trying to generate triangles from wedges and 3 points in euclidean space (think like 3d) and I am using this module from @EgoMoose

However when attempting to use the module I get an error saying that these dot products are basically nil

``````local abd, acd, bcd = ab:Dot(ab), ac:Dot(ac), bc:Dot(bc);
``````

My main code is this

``````local triangleModule = require(script.GenerateTriangle)

triangleModule.draw3dTriangle(0, 1, 5, workspace)
``````

Here is the place file Baseplate.rbxl (20.0 KB)

It expects Vector3s. Not numbers.

The error isnâ€™t saying theyâ€™re nil. Itâ€™s saying youâ€™re trying to call Dot() on a number.

How do I fix it then? I didnâ€™t write the code I just got it from github

`:Dot()` is a method of `Vector3`, looking at the moduleâ€™s code, ab, ac, and bc are the result of a series of subtractions between the first three inputted arguments. Meaning those three arguments should be vectors, not numbers, presumably representing the 3D position of each of the triangleâ€™s vertices.

Itâ€™s better to read the article before blindly using the code, else use a documented module.

Could you link one with documentation?

I couldnâ€™t find any, but you can look for yourself. If you end up not finding one, just go back to egomooseâ€™s article, and try to understand what the `a`, `b` and `c` arguments need to be. Like I said, theyâ€™re probably the positions of vertices.

This is what youâ€™re trying to do.

You gave the function a single number, which I imagine you thought was a 3D point. You clearly canâ€™t draw a triangle with just that yellow dot above.

What you need to do is give it three points in 3D space like this.

``````local triangleModule = require(script.GenerateTriangle)

triangleModule.draw3dTriangle(Vector3.new(5,0,0), Vector3.new(0,5,0), Vector3.new(0,0,5), workspace)
``````
1 Like