Creating 3D Models
Example Prompt:
Example Response:
import bpy
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 0, 0))
obj = bpy.context.object
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.transform.resize(value=(1, 1, 1)) # Adjust based on your reference
bpy.ops.object.mode_set(mode='OBJECT')
Related Tasks:
Creating Custom Shaders
Example Prompt:
Example Response:
vec4 texColor = texture(myTexture, uv);
// Use texColor instead of calling texture(myTexture, uv) multiple times
// Original
void main() {
vec4 color = texture(myTexture, uv);
if (color.a < 0.5) {
discard;
}
gl_FragColor = color;
}
// Optimized
void main() {
vec4 color = texture(myTexture, uv);
gl_FragColor = (color.a < 0.5) ? vec4(0.0) : color;
}
Related Tasks:
Integrating Assets into Game Engines
Example Prompt:
Example Response:
using UnityEngine;
public class ModelSpawner : MonoBehaviour {
public GameObject modelPrefab; // Assign your model prefab in the Inspector
void Start() {
Instantiate(modelPrefab, new Vector3(0, 0, 0), Quaternion.identity);
}
}
Related Tasks:
Writing Technical Documentation
Example Prompt:
Example Response:
Related Tasks:
Debugging Technical Issues
Example Prompt:
Example Response:
if (someCondition) {
gl_FragColor = vec4(1, 0, 0, 1); // Red for true
} else {
gl_FragColor = vec4(0, 0, 1, 1); // Blue for false
}
float myVariable; // Declare the variable
Related Tasks: